for i:= 0 to count-1 do
begin
BtnArray[i]:=TBuuton.Create(YourForm);
BtnArray[i].Parent:=YourForm;
......
end;在类里写个 procedure MyBtnClick(sender:TObject)
BtnArray[i].OnClick:=MyBtnClick;
begin
BtnArray[i]:=TBuuton.Create(YourForm);
BtnArray[i].Parent:=YourForm;
......
end;在类里写个 procedure MyBtnClick(sender:TObject)
BtnArray[i].OnClick:=MyBtnClick;
解决方案 »
- 关于ADOConnection连接超时的设置
- 关于线程动态创建VCL组件的问题
- 如何获得“C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5”
- 如何阻止一个已经运行的程序再次运行?
- 导数据到excel中去怎幺老是死机?
- 嘻嘻,卖身了,up有分
- 问一个关于在DBGrid中实现选择式输入数据的问题
- 三层结构为什么用ClientDataSet传汉字参数.字节会减少,如何解决?
- 关于Ini文件的问题
- TDBGrid 多选的记录怎么访问?
- 免费赠送完全仿Neoplant和“电子日记本”的Delphi窗体模块
- 在DELPHI中如何对备注字段进行模糊查询?
var
BtnArray : array[1..10] of TButton;
……
var
MyB:array of TSpeedButton;
begin
Setlength(MyB,table1.RecordCount);
table1.First;
i:=0;
while not(table1.eof) do
begin
if table1.FieldByName('parent').asinteger=0 then
begin
MyB[I]:=TSpeedButton.Create(self);
MyB[I].Parent:=panel1;
{加入位置及宽高控制如:myb[i].width:=40;}
MyB[i].flat:=true;
MyB[i].caption:=trim(table1.fieldbyname('caption').asstring
Myb[i].onClick:=buttonclick;//按纽事件
i:=i+1;
end;
table1.next;
end;
end;