Beispiel #1
0
        private void timerCloseAll_Tick(object sender, EventArgs e)
        {
            bool allDeactivated = true;

            for (FrmPanel frm = this.MyParent; frm != null; frm = frm.MyParent)
            {
                if (frm.Focused || frm.ContainsFocus)
                {
                    allDeactivated = false;
                    break;
                }
            }

            for (FrmPanel frm = this; frm != null; frm = frm.MyChild)
            {
                if (frm.Focused || frm.ContainsFocus)
                {
                    allDeactivated = false;
                    break;
                }
            }

            if (allDeactivated)
            {
                CloseAll();
            }
        }
Beispiel #2
0
        private void CloseAll()
        {
            FrmPanel parent = this;

            for (; parent.MyParent != null; parent = parent.MyParent)
            {
            }
            parent.Close();
        }
Beispiel #3
0
        public void ShowChild(FrmPanel frmChild, Control sender = null)
        {
            frmChild.MyParent = this;

            MyChild?.Close();
            MyChild = frmChild;

            frmChild.Show(this);

            if (sender != null)
            {
                frmChild.Location = new Point(this.Left - frmChild.Width, sender.Top + this.Top);
            }
        }