Example #1
0
        /// <summary>
        /// 先关后开.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void closeOpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 遍历当前窗口的所有 mid 子窗口.
            foreach (Form oldForm in this.MdiChildren)
            {
                // 如果窗口类型为 指定类型,那么先关闭掉.
                if (oldForm is FormCloseOpen)
                {
                    oldForm.Close();
                }
            }

            // 关闭旧窗口以后,简单创建新窗口 并显示.
            FormCloseOpen newForm = new FormCloseOpen();
            newForm.MdiParent = this;
            newForm.Show();
        }
Example #2
0
        /// <summary>
        /// 先关后开.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void closeOpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 遍历当前窗口的所有 mid 子窗口.
            foreach (Form oldForm in this.MdiChildren)
            {
                // 如果窗口类型为 指定类型,那么先关闭掉.
                if (oldForm is FormCloseOpen)
                {
                    oldForm.Close();
                }
            }

            // 关闭旧窗口以后,简单创建新窗口 并显示.
            FormCloseOpen newForm = new FormCloseOpen();

            newForm.MdiParent = this;
            newForm.Show();
        }