scene

In general, when developing WinForm form, a button will be dragged, and then double-click to enter the button click event, and

Click to write the event.

If there is no button on the form in advance, it is a button generated in the code. How to write its click event.

Realization

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

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

 

Effect