![](/img/trans.png)
[英]How to close the previous child form on clicking another child form in mdi using c#
[英]How to close previous mdi child in parent form
我有一個mdi父form
,我通過以下代碼在運行時打開我的其他forms
作為mdi子表單:
private void MenuItem_Click(object sender, EventArgs e)
{
childform = new childform ();
frm.MdiParent = Mdiparent;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
}
但問題是:當當前表單打開時,用戶可以打開另一個表單,並且可以重復多次,以便打開每個表單,以便在用戶打開新的子表單之前關閉當前子表單的代碼?
tanx for ur assist :)我發現有效的代碼通過測試類Windows.forms中的其他成員來檢查這個:
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.