可执行文件存放于:http://bbs.51testing.com/thread-71954-1-1.html
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, shellapi;
type
TForm1 = class(TForm)
pnl1: TPanel;
edt1: TEdit;
btn2: TButton;
btn1: TButton;
pnl2: TPanel;
mmo2: TMemo;
lbl1: TLabel;
lbl2: TLabel;
edt2: TEdit;
ud1: TUpDown;
lbl3: TLabel;
edt3: TEdit;
ud2: TUpDown;
btn3: TButton;
btn4: TButton;
CheckBox1: TCheckBox;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
StatusBar1: TStatusBar;
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure btn3Click(Sender: TObject);
procedure btn4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
edt1.Clear;
edt2.Clear;
edt3.Clear;
end;
procedure TForm1.btn2Click(Sender: TObject);
var
i: integer;
begin
try
strtoint(edt2.Text);
except
application.MessageBox('请输入整数!', '系统信息', 32);
edt2.SetFocus;
exit;
end;
try
strtoint(edt3.Text);
except
application.MessageBox('请输入整数!', '系统信息', 32);
edt3.SetFocus;
exit;
end;
mmo2.Lines.Clear;
if trim(edt2.Text) = '' then edt2.Text := '0';
if not CheckBox1.Checked then begin
for i := strtoint(edt2.Text) to strtoint(edt2.Text) + strtoint(edt3.Text) - 1 do
mmo2.Lines.Add(edt1.Text + inttostr(i));
end else begin
for i := strtoint(edt2.Text) to strtoint(edt2.Text) + strtoint(edt3.Text) - 1 do
mmo2.Lines.Add(edt1.Text);
end;
if mmo2.Lines.Count>0 then btn4.Enabled := true else btn4.Enabled := false;
end;
procedure TForm1.btn3Click(Sender: TObject);
begin
halt;
end;
procedure TForm1.btn4Click(Sender: TObject);
begin
mmo2.Lines.SaveToFile('c:\test.txt');
ShellExecute(Handle, 'open', 'c:\test.txt', nil, nil, SW_SHOWNORMAL);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i :integer;
begin
mmo2.Lines.Clear;
for i:=0 to memo1.Lines.Count-1 do
begin
mmo2.Lines.Add(edt1.Text+memo1.Lines.Strings[i]);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i :integer;
begin
mmo2.Lines.Clear;
for i:=0 to memo1.Lines.Count-1 do
begin
mmo2.Lines.Add(memo1.Lines.Strings[i]+edt1.Text);
end;
end;
end.
Link URL:
http://www.cnblogs.com/tester2test/archive/2007/04/04/699598.html