请问怎么样得到剪贴板的信息 (转载)
发信人: sowhat (小华), 信区: Delphi
标 题: Re: 请问怎么样得到剪贴板的信息 (转载)
发信站: BBS 水木清华站 (Sat Nov 27 20:22:40 1999)
如果只处理文字,那么TEdit之类的编辑组件具有可以直接调用
的方法如PastFromClipboard。例如:
procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEdit1.CopyToClipboard;
Edit1.Clear;
Edit1.PasteFromClipboard;
RichEdit1.SetFocus;
end;
如果还要处理图形,那么需要用到预定义的系统对象Clipboard。例如:
procedure TForm1.PasteButtonClick(Sender: TObject);
var
Bitmap: TBitmap;
begin
if Clipboard.HasFormat(CF_BITMAP) then { check to see if there is a pictur
e }
begin
Bitmap := TBitmap.Create; {Create a bitmap to hold the contents of the
Clipboard}
try
Bitmap.Assign(Clipboard); {get the bitmap off the clipboard using Ass
ign}
Image.Canvas.Draw(0, 0, Bitmap); {copy the bitmap to the Image}
finally
Bitmap.Free;
end;
end;
end;
【在 lyra (打倒北约) 的大作中提到: 】
:
【以下文字转载自 Database 讨论区】
:
【原文由 lyra 所发表】
:
比如:剪贴板中是否右内容??thanx
--
抬起头在天边,低下头在人间;闭上眼是故乡,睁开眼是苍茫。
抬起头在天边,低下头在人间;转过身是欺骗,走向前是无言。
※来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 166.111.10.156]