📜  动态添加事件控件 c# Code Example

📅  最后修改于: 2022-03-11 14:48:49.840000             🧑  作者: Mango

代码示例1
private void Form1_Load(object sender, EventArgs e)
{
    Button b = new Button();
    b.Click += new EventHandler(ShowMessage);
    Controls.Add(b);
}

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