200分求助滚动抓图,滚动抓文字 ( 积分: 100 )

F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
能给出滚动抓图就像snagit里给带滚动条的窗口抓图一样的效果100分<br>能给出滚动抓文字就像snagit里给带滚动条的窗口抓文字一样的效果100分<br>因为没人回答分就浪费了,所以我会另开贴散分的<br>拜托照顾一下小鸟,能不能给源码,不能给能不能思路说的细些
 
F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
能给出滚动抓图就像snagit里给带滚动条的窗口抓图一样的效果100分<br>能给出滚动抓文字就像snagit里给带滚动条的窗口抓文字一样的效果100分<br>因为没人回答分就浪费了,所以我会另开贴散分的<br>拜托照顾一下小鸟,能不能给源码,不能给能不能思路说的细些
 
F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
诸位高手高手高高手,嫌分少开个数吧,不要都这么深沉嘛,又不是沉睡的羔羊,灌水也支持!
 
L

lich

Unregistered / Unconfirmed
GUEST, unregistred user!
发送滚动条消息, 多次抓屏然后通过特定算法,将图像接合在一起
 
L

lghxedit

Unregistered / Unconfirmed
GUEST, unregistred user!
这里有滚动抓网页的代码,希望对你有帮助:<br><br>var<br> &nbsp;Doc: IHTMLDocument2;<br> &nbsp;ViewObject: IViewObject;<br> &nbsp;sourceDrawRect: TRect;<br> &nbsp;a, getjpg: TBitMap;<br> &nbsp;i, m: integer;<br> &nbsp;pdest, psour: hbitmap;<br> &nbsp;jpg: tjpegimage;<br>begin<br> &nbsp;Doc := WebBrowser1.Document as IHTMLDocument2;<br> &nbsp;if WebBrowser1.Document &amp;lt;&amp;gt; nil then<br> &nbsp;try<br> &nbsp; &nbsp;WebBrowser1.Document.QueryInterface(IViewObject, ViewObject);<br> &nbsp; &nbsp;if ViewObject &amp;lt;&amp;gt; nil then<br> &nbsp; &nbsp;try<br> &nbsp; &nbsp; &nbsp;Doc.Get_ParentWindow.Scroll(0, 0); //跳到网页头<br> &nbsp; &nbsp; &nbsp;getjpg := TBitMap.Create();<br> &nbsp; &nbsp; &nbsp;getjpg.PixelFormat := pf24bit;<br> &nbsp; &nbsp; &nbsp;getjpg.Height := doc.Body.getAttribute('scrollHeight', 0);<br> &nbsp; &nbsp; &nbsp;getjpg.Width := doc.Body.getAttribute('scrollwidth', 0);<br> &nbsp; &nbsp; &nbsp;pdest := getjpg.Canvas.Handle;<br> &nbsp; &nbsp; &nbsp;m := Trunc(doc.Body.getAttribute('ScrollHeight', 0) / (doc.Body.getAttribute('offsetHeight', 0) - 20));<br> &nbsp; &nbsp; &nbsp;i := Trunc(doc.Body.getAttribute('Scrollwidth', 0) / (doc.Body.getAttribute('offsetwidth', 0) - 20));<br> &nbsp; &nbsp; &nbsp;for i := 0 to i do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;for m := 0 to m + 1 do<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a := TBitMap.Create();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a.Height := doc.Body.getAttribute('offsetHeight', 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a.Width := doc.Body.getAttribute('offsetwidth', 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;psour := a.Canvas.handle;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sourceDrawRect := Rect(0, 0, a.Width, a.Height);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil, Self.Handle, a.Canvas.Handle, @sourceDrawRect, nil, nil, 0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bitblt(pdest, doc.Body.getAttribute('scrollLeft', 0), doc.Body.getAttribute('Scrolltop', 0), a.Width, a.Height, psour, 2, 2, srccopy);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Doc.Get_ParentWindow.Scroll(doc.Body.getAttribute('scrollLeft', 0), doc.Body.getAttribute('offsetHeight', 0) + doc.Body.getAttribute('Scrolltop', 0) - GetSystemMetrics(SM_CXVSCROLL) - 24);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a.Free;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp;Doc.Get_ParentWindow.Scroll(doc.Body.getAttribute('offsetwidth', 0) + doc.Body.getAttribute('scrollLeft', 0) - GetSystemMetrics(SM_CXVSCROLL) - 24, 0);<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp;jpg := tjpegimage.Create;<br> &nbsp; &nbsp; &nbsp;jpg.Assign(getjpg);<br> &nbsp; &nbsp; &nbsp;getjpg.Free;<br> &nbsp; &nbsp; &nbsp;jpg.SaveToFile('demo.jpg');<br> &nbsp; &nbsp; &nbsp;jpg.Free;<br> &nbsp; &nbsp;finally<br> &nbsp; &nbsp; &nbsp;ViewObject._Release;<br> &nbsp; &nbsp;end;<br> &nbsp;except<br> &nbsp;end;<br>end;
 
S

savetime

Unregistered / Unconfirmed
GUEST, unregistred user!
看看下面的例子,大概就明白原理了。<br><br><br>把整个网页保存成JPG图片(针对单框架网页) <br>http://www.2ccc.com/article.asp?articleid=1423<br><br>滚屏截图的演示例子<br>http://www.2ccc.com/article.asp?articleid=725<br><br>Capture an HTML document as an image <br>http://www.codeproject.com/internet/htmlimagecapture.asp
 
F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
感谢感谢,不知到抓文字有思路没?
 

青出于蓝

Unregistered / Unconfirmed
GUEST, unregistred user!
上面的滚屏截图的演示例子是我写的,不太完善。抓文字应该不能实现。
 
F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
savetime同志的第一个demo抓图时图片有黑道联结,而且图片重复拼凑,第二个例子还可以不过抓图越多速度越慢不像snagit那样流畅.不过分还是分了吧
 
F

funxu

Unregistered / Unconfirmed
GUEST, unregistred user!
抓文字我找到了一个替代方方法,谁让我是菜鸟呢
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部