一般在进行Winform窗体开发时都会拖拽一个Button,然后双击进入Button按钮的点击事件中,进行

点击事件的编写。

如果窗体上事先没有Button按钮,是在代码中生成的Button按钮,如何编写它的点击事件。

实现

SimpleButton confirmbButton = new SimpleButton();
confirmbButton.Click +=confirmbButton_Click;

private void confirmbButton_Click(object sender, EventArgs e)
        {
            MessageBox.Show("AAA");
        }

 

效果

Winform中使用代码编写Button按钮的点击事件

Winform中使用代码编写Button按钮的点击事件

 

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-01-26
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2021-12-04
  • 2021-07-18
相关资源
相似解决方案