我怎麼能一次只允許一個窗口,當我點擊menutrip菜單?允許Menustrip在此刻只有一個孩子
例如:我有Menustrip Ordre,Tarif等...當我第一次點擊Ordre時,它會打開一個新窗體,但是第二次我想禁止它。
private void ordresToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Already open)
{
}
else
{
Lordre newMDIChild = new Lordre(ClientId);
// Set the Parent Form of the Child window.
newMDIChild.MdiParent = this;
// Display the new form.
newMDIChild.Show();
}
}
感謝您提前
那麼,你第二次想要什麼行爲?菜單項是否應該禁用?它是否應該激活已經存在的表單實例? –