5,388
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.Button1Click(Sender: TObject);
begin
if Sender is TCustomEdit then
TCustomEdit(Sender).CopyToClipboard;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if Sender is TCustomEdit then
TCustomEdit(Sender)..PasteFromClipboard;
end;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
edt1: TEdit;
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses Clipbrd;
//点完btn1Click后,在系统其它地方粘贴一下试试
procedure TForm1.btn1Click(Sender: TObject);
var
clip: TClipboard;
begin
clip := TClipboard.Create;
try
clip.AsText := edt1.Text;
finally
clip.Free;
end;
end;
end.