C#中如何用代码创建一个按钮

2024-12-01 08:02:08
推荐回答(1个)
回答1:

Button btn = new Button();
btn.Size = new Size(50, 30);
btn.Location = new Point(100, 100);
btn.Name = "btn";
btn.Text = "Button";
this.Controls.Add(btn);