Exemplo n.º 1
0
        protected override void OnTabClosing(CancelableMdiTabEventArgs e)
        {
            base.OnTabClosing(e);

            // just in case the user of the mdi tab workspace
            // wants the tab to be opened, cancel it if the workspace
            // is being explicitly told to remove the smart part
            if (e.Tab == this.tabForcingClosed)
            {
                e.Cancel = false;
            }

            if (!e.Cancel && this.composer.ContainsItem(e.Tab))
            {
                // TODO call off their close method?

                Control smartPart = this.GetSmartPart(e.Tab);

                if (null != smartPart)
                {
                    WorkspaceCancelEventArgs args = new WorkspaceCancelEventArgs(smartPart);

                    this.OnSmartPartClosing(args);

                    if (args.Cancel)
                    {
                        e.Cancel = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void tabbedMdiManager_TabClosing(object sender, CancelableMdiTabEventArgs e)
        {
            var form = e.Tab.Form;

            _childForms.Remove(form);
        }