[英]How to add a User Control in a Panel from a button click of another User Control?
[英]How to add second user control in panel by button click in first user control
我有一個winform和一個面板 ,並且在運行時將一個用戶控件( 第一個用戶控件 )加載到面板中,我的問題是如何通過單擊第一個用戶控件中的按鈕在同一面板中添加第二個 用戶控件 。 我只想簡單地通過單擊位於第一個用戶控件中的next按鈕來訪問下一個用戶控件。
如果您嘗試使用按鈕創建按鈕,則可能會有所幫助。 但是,請清楚您的要求。
private void button1_Click(object sender, EventArgs e)
{
Button newButton = new Button();
//insert control properties here
this.Controls.Add(newButton);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.