本文整理自网络,侵删。
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,clipbrd,strutils;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Button2: TButton; Edit3: TEdit; Label3: TLabel; Label4: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var i:Integer; clip: TClipboard; t1:tstringlist;begin t1:=tstringlist.create; clip := TClipboard.Create; {建立} for i:=StrToInt(edit1.text)-1 to StrToInt(edit2.text)-1 do begin t1.add(memo1.lines[i]); end; clip.AsText := t1.text; {把窗体标题放入剪切板} clip.Free; {释放} t1.Free;end;procedure TForm1.Button2Click(Sender: TObject);begin memo1.Lines.loadfromfile(Edit3.text);end;end.
相关阅读 >>
Delphi webbrowser中模拟连接点击(非鼠标模拟)
Delphi:取得浏览器地址,网址(支持ie,firefox)
更多相关阅读请进入《Delphi》频道 >>