拷贝剪贴板图像到窗体
procedure TBitmap.LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE);
uses Clipbrd;
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp : TBitmap;
begin
Bmp := TBitMap.create;
try
if Clipboard.HasFormat(CF_BITMAP) then
begin
Bmp.LoadFromClipBoardFormat(CF_BITMAP,ClipBoard.GetAsHandle(CF_BITMAP),0);
Canvas.Draw(0,0,bmp);
Bmp.SaveToFile(‘C:\ClipBord.bmp‘);
end;
finally
Bmp.free;
end;
end;
var
Bmp : TBitmap;
begin
Bmp := TBitMap.create;
try
if Clipboard.HasFormat(CF_BITMAP) then
begin
Bmp.LoadFromClipBoardFormat(CF_BITMAP,ClipBoard.GetAsHandle(CF_BITMAP),0);
Canvas.Draw(0,0,bmp);
Bmp.SaveToFile(‘C:\ClipBord.bmp‘);
end;
finally
Bmp.free;
end;
end;
Webbrowser粘贴位图