复制文本到剪贴版和从剪贴版取文字 uses ClipBrd; procedure StrToClipbrd(StrValue: string);varA: array[0..255] of char;beginStrPCopy(A, StrValue);Clipboard.SetTextBuf(A);end;function GetStrFromClipbrd : string;beginif Clipboard.HasFormat(CF_TEXT) thenresult := Clipboard.AsTextelsebeginShowMessage('There is no text in the Clipboard!');result := '';end;end;
在粘贴button中写procedure TForm1.Button1Click(Sender: TObject); begin edit1.PasteFromClipboard; end;
uses ClipBrd;
procedure StrToClipbrd(StrValue: string);varA: array[0..255] of char;beginStrPCopy(A, StrValue);Clipboard.SetTextBuf(A);end;function GetStrFromClipbrd : string;beginif Clipboard.HasFormat(CF_TEXT) thenresult := Clipboard.AsTextelsebeginShowMessage('There is no text in the Clipboard!');result := '';end;end;
begin
edit1.PasteFromClipboard;
end;