【问题标题】:Adding new button on button click C# winform在按钮上添加新按钮单击 C# winform
【发布时间】:2018-06-26 00:41:37
【问题描述】:

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

【问题讨论】:

  • try on your own。向表单添加按钮是一项非常基本的任务。

标签: c# winforms


【解决方案1】:

编写以下代码 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);

试试上面的代码。

【讨论】:

    猜你喜欢
    • 2015-05-12
    • 1970-01-01
    • 2017-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多