注意:不是直接print screen or Alt-printScreen,因为有的时候窗口没有最大化,
网页只能被看见一部分, 同时我不希望我的程序的界面(诸如菜单条等)和网页一起
保存下来。
如果网页的垂直方向上大于屏幕的高,则只保存网页第一行开始的第一屏。
From DFW(Holyowl) 时间:2001-4-29 12:22:20, ID:518930
A Sample:
procedure TForm1.Button1Click(Sender: TObject);
var
ViewObject: IViewObject;
sourceDrawRect: TRect;
begin
if Webbrowser1.Document <> nil then
try
webbrowser1.Document.QueryInterface(IViewObject, ViewObject);
if ViewObject <> nil then
try
sourceDrawRect := Rect(0, 0, Image1.Width, Image1.Height);
ViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil, Self.Handle,
image1.Canvas.Handle, @sourceDrawRect, nil, nil, 0);
finally
ViewObject._Release;
end;
except
end;
end;