Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
Exemplo n.º 1
0
        internal void CloseToolStrip()
        {
            if (dropDownToolStrip == null)
            {
                return;
            }

            if (dropDownToolStrip.IsDisposed == false)
            {
                dropDownToolStrip.Dispose();
            }
        }
Exemplo n.º 2
0
        /// <include file='doc\ToolStripDropDownItem.uex' path='docs/doc[@for="ToolStripDropDownItem.Dispose"]/*' />
        /// <devdoc>
        /// Make sure we unhook dropdown events.
        /// </devdoc>
        protected override void Dispose(bool disposing)
        {
            if (this.dropDown != null)
            {
                dropDown.Opened      -= new EventHandler(DropDown_Opened);
                dropDown.Closed      -= new ToolStripDropDownClosedEventHandler(DropDown_Closed);
                dropDown.ItemClicked -= new ToolStripItemClickedEventHandler(DropDown_ItemClicked);

                if (disposing && dropDown.IsAutoGenerated)
                {
                    // if we created the dropdown, dispose it and its children.
                    dropDown.Dispose();
                    dropDown = null;
                }
            }
            base.Dispose(disposing);
        }