在按钮上添加新按钮,然后单击C#winform

时间:2018-06-26 00:41:37

标签: c# winforms

我想在单击此(+)按钮时添加一个新的自定义按钮。我已经在互联网上搜索了很多,但一无所获。如果有人可以帮助我,我会很高兴的,谢谢您。

Example

1 个答案:

答案 0 :(得分:0)

编写以下代码onclick按钮事件,这是一个非常简单的任务。

//Creating New Button                
Button btn = new Button();
//Adding Some text to button
btn.Text = "New Button";
//Specifing Location of Button to be placed
btn.Location = new Point(200, 200);
//Adding button to form 
this.Controls.Add(btn);

尝试上面的代码。