这个代码那里出了错误呀???
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
abutton:array [1..100] of TButton;
procedure ButtonAllClick(sender:Tobject);
public
{ Public declarations }
end;
procedure TForm1.ButtonAllClick(sender:Tobject);
begin
application.MessageBox(TButton(sender).caption,'对话框',MB_OK);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
i,j:integer;
begin
for i:=0 to 9 do
begin
for j:=1 to 10 do
begin
abutton[i*10+j]:=Tbutton.Create(self);
abutton[i*10+j].Parent:=Self;
abutton[i*10+j].Width:=100;
abutton[i*10+j].Height:=30;
abutton[i*10+j].Left:=i*abutton[i*10+j].Width+20;
abutton[i*10+j].Top:=j*abutton[i*10+j].Height+20;
abutton[i*10+j].Caption:=inttostr(i*10+j);
abutton[i*10+j].OnClick:=ButtonAllClick;
end;
end;
end;
end.