专注于软件测试理论+实践,自动化测试(功能、性能),希望广交天下爱好测试的朋友,积极加入我的圈圈!测试者家园期待您的加入!

大数据量生成工具源代码(Delphi)

上一篇 / 下一篇  2007-06-20 22:43:11

可执行文件存放于: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.



测试者家园 2007-04-04 12:52 发表评论


Link URL: http://www.cnblogs.com/tester2test/archive/2007/04/04/699598.html

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2011-06-09  
   1234
567891011
12131415161718
19202122232425
2627282930  

数据统计

  • 访问量: 8961
  • 日志数: 150
  • 建立时间: 2007-04-23
  • 更新时间: 2007-06-21

RSS订阅

Open Toolbar