procedure TForm1.BitBtn1Click(Sender: TObject);
var
Bitmap: TBitmap;
i, lformat: integer;
mete: TMetafile;
begin
for i := 0 to Clipboard.FormatCount - 1 do
begin
ListBox1.Items.Add(IntToStr(Clipboard.Formats[i]));
lformat := Clipboard.Formats[i];
case lformat of
CF_BITMAP:
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromClipboardFormat(CF_BITMAP, Clipboard.GetAsHandle(CF_BITMAP), 0);
Canvas.draw(0, 0, Bitmap);
Bitmap.SaveToFile('zxm.bmp');
Image1.Picture.LoadFromFile('zxm.bmp');
finally
Bitmap.Free;
end;
end;
CF_METAFILEPICT:
begin
mete := TMetafile.Create;
try
mete.LoadFromClipboardFormat(CF_METAFILEPICT, Clipboard.GetAsHandle(CF_METAFILEPICT), 0); //在这句出错了!出错提示:UnSupported Clipboard Format
Image1.Picture.Assign(mete);
finally
mete.Free;
end;
end;
end;
end;
ListBox1.Items.Add('-------------');
end;
var
Bitmap: TBitmap;
i, lformat: integer;
mete: TMetafile;
begin
for i := 0 to Clipboard.FormatCount - 1 do
begin
ListBox1.Items.Add(IntToStr(Clipboard.Formats[i]));
lformat := Clipboard.Formats[i];
case lformat of
CF_BITMAP:
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromClipboardFormat(CF_BITMAP, Clipboard.GetAsHandle(CF_BITMAP), 0);
Canvas.draw(0, 0, Bitmap);
Bitmap.SaveToFile('zxm.bmp');
Image1.Picture.LoadFromFile('zxm.bmp');
finally
Bitmap.Free;
end;
end;
CF_METAFILEPICT:
begin
mete := TMetafile.Create;
try
mete.LoadFromClipboardFormat(CF_METAFILEPICT, Clipboard.GetAsHandle(CF_METAFILEPICT), 0); //在这句出错了!出错提示:UnSupported Clipboard Format
Image1.Picture.Assign(mete);
finally
mete.Free;
end;
end;
end;
end;
ListBox1.Items.Add('-------------');
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货