Exemple #1
0
        public void OnMyCloseForm(MyFormBase form)
        {
            if (!_checkOnChildrenEvents)
            {
                return;
            }
            if (!_myChildren.Contains(form))
            {
                return;
            }
            int k = _myChildren.IndexOf(form);

            _myChildren.RemoveAt(k);

            if (!form.IsMyDialog)
            {
                SelectLastForm();
                OnMyChildrenChanged();
                return;
            }

            for (int i = k - 1; i >= 0; i--)
            {
                _myChildren[i].Enabled = true;
                //_myChildren[i].Visible = true;
                if (_myChildren[i].IsMyDialog)
                {
                    break;
                }
            }
            SelectLastForm();
            OnMyChildrenChanged();
            return;
        }
Exemple #2
0
        private void FormMainBase_MdiChildActivate(object sender, EventArgs e)
        {
            if (_myChildToolStrip != null && this.MyToolStrip != null)
            {
                ToolStripManager.RevertMerge(this.MyToolStrip, _myChildToolStrip);
                _myChildToolStrip = null;
            }
            if (ActiveMdiChild is MyFormBase)
            {
                MyFormBase f = ActiveMdiChild as MyFormBase;
                _myChildren.Remove(f);
                _myChildren.Add(f);

                if (f.IsMyDialog)
                {
                    for (int i = _myChildren.Count - 2; i >= 0; i--)
                    {
                        if (!_myChildren[i].Enabled)
                        {
                            break;
                        }
                        //_myChildren[i].ActiveControl = null;
                        _myChildren[i].Enabled = false;
                        //_myChildren[i].Visible = false;
                    }
                }

                if (f.MyToolStrip != null && this.MyToolStrip != null)
                {
                    ToolStripManager.Merge(f.MyToolStrip, this.MyToolStrip);
                }
                _myChildToolStrip = f.MyToolStrip;
            }
            if (MyToolStrip != null)
            {
                this.MyToolStrip.Visible = this.MyToolStrip.Items.Count > 0;
            }
        }