private void gunaButton1_Click(object sender, EventArgs e) { for (int i = 0; i < 1; i ) { GunaButton btn = new GunaButton();
//add btn to flowlayoutpanel to arrange buttons flowLayoutPanel1.Controls.Add(btn); Form2 f = new Form2(); //how can i make object of button show new object of form2 btn.Click =new System.EventHandler(f.ShowDialog()); } }
uj5u.com熱心網友回復:
嘗試:
btn.Click = new System.EventHandler(this.btn_Click);
private void btn_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/491506.html
上一篇:mySQL插入失敗:使用Doctrine和Symfony6.0的save()方法上的UUID變為空
下一篇:如何根據欄位中的冒號拆分物件陣列
