希望我的描述比较清楚.
- C# code
SmartTimers smartTimers = new SmartTimers(); smartTimers.MdiParent = this; smartTimers.Show();//SmartTimers窗口的 private void SmartTimers_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; this.WindowState = FormWindowState.Minimized; }
这样,比较痛苦的问题就来了,我想关闭MDI窗口,应该怎么关闭呢?
请各位有过这样问题的朋友帮个忙.
------解决方案--------------------------------------------------------
设置一个静态公共变量,初始值为false
关闭子窗口时,判断该变量的状态,false为不关闭
要关闭MDI时,设置为true
- C# code
SmartTimers smartTimers = new SmartTimers(); smartTimers.MdiParent = this; smartTimers.Show();//SmartTimers窗口的 private void SmartTimers_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = Common.IsMDIExit;//Common.IsMDIExit为静态公共变量 this.WindowState = FormWindowState.Minimized; }