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