如何把动态创建的button显示在Form1上?

neighbornet 2003-01-29 11:53:13
如何把动态创建的button显示在Form1上?
...全文
35 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
idilent 2003-01-29
  • 打赏
  • 举报
回复
重要的一句是btn.parent = Form1.
xbxsoft 2003-01-29
  • 打赏
  • 举报
回复
var
Button1 : array[1..26] of TButton;
I:integer;
begin
i:=1;
button1[i]:= TButton.Create(self) ;
Button1[i].Caption := '1';
Button[i].Parent:=form1;
DriverButton[Counter].OnClick := ButtonMouseDown; //ONCLICK事件

procedure TForm1.ButtonMouseDown(Sender: TObject);
begin
caption := TButton(Sender).caption;
end;

Eastunfail 2003-01-29
  • 打赏
  • 举报
回复
var button:TButton;
begin
button:=TButton.Create(self);
button.caption="test"
end;
neighbornet 2003-01-29
  • 打赏
  • 举报
回复
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TButton *Button=new TButton(Form1);
Button->Caption="test";
}

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧