Re: Copy Image to Clipboard
profgrid.com

Hi Peter:
procedure TForm1.ToolButton1Click(Sender: TObject);
var
D: IDispatch;
Element: IHTMLElement;
B: TBitmap;
ImgElement: IHTMLImgElement;
begin
if ProfDHTMLEdit21.IsImageSelected then
if ProfDHTMLEdit21.GetDOM(D) then
begin
Element := ((D as IHTMLDocument2).selection.createRange as IHTMLControlRange).commonParentElement;
B := TBitmap.Create;
try
ImgElement := Element as IHTMLImgElement;
B.Width := ImgElement.width;
B.Height := ImgElement.height;
(Element as IHTMLElementRender).DrawToDC(B.Canvas.Handle);
Clipboard.Assign(B)
finally
B.Free
end
end
end;
-Nicholas