Ok so I have this Timage control on the board, and I am taking a screenshot of a tbrowser component, and that works fine. The problem is that if I go to another web page the old image stays in the image control and the new one doesn't load. How do I clear this canvas and re-load something new onto it?
This is the code I use to take the browser screenshot:
procedure TForm1.wbNavigateComplete2(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
ViewObject: IViewObject;
sourceDrawRect: TRect;
begin
if wb.Document <> nil then
try
wb.Document.QueryInterface(IViewObject, ViewObject);
if ViewObject <> nil then
try
sourceDrawRect := Rect(-1, -1, wb.Width, wb.Height);
ViewObject.Draw(DVASPECT_CONTENT {DVASPECT_THUMBNAIL}, 1, nil, nil, Self.Handle,
Image1.Canvas.Handle, @sourceDrawRect, nil, nil, 0);
finally
ViewObject._Release;
end;
except
end;
image1.Enabled := true;
end;
This is the code I use to take the browser screenshot:
procedure TForm1.wbNavigateComplete2(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
ViewObject: IViewObject;
sourceDrawRect: TRect;
begin
if wb.Document <> nil then
try
wb.Document.QueryInterface(IViewObject, ViewObject);
if ViewObject <> nil then
try
sourceDrawRect := Rect(-1, -1, wb.Width, wb.Height);
ViewObject.Draw(DVASPECT_CONTENT {DVASPECT_THUMBNAIL}, 1, nil, nil, Self.Handle,
Image1.Canvas.Handle, @sourceDrawRect, nil, nil, 0);
finally
ViewObject._Release;
end;
except
end;
image1.Enabled := true;
end;