ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupRichTextBox.Dispose C# (CSharp) Method

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_ribbonRichTextBox != null)
                {
                    // Must unhook to prevent memory leaks
                    _ribbonRichTextBox.MouseEnterControl -= new EventHandler(OnMouseEnterControl);
                    _ribbonRichTextBox.MouseLeaveControl -= new EventHandler(OnMouseLeaveControl);
                    _ribbonRichTextBox.ViewPaintDelegate = null;
                    _ribbonRichTextBox.PropertyChanged -= new PropertyChangedEventHandler(OnRichTextBoxPropertyChanged);
                    _ribbon.ViewRibbonManager.LayoutAfter -= new EventHandler(OnLayoutAction);
                    _ribbon.ViewRibbonManager.LayoutBefore -= new EventHandler(OnLayoutAction);

                    // Remove association with definition
                    _ribbonRichTextBox.RichTextBoxView = null;
                    _ribbonRichTextBox = null;
                }
            }

            base.Dispose(disposing);
        }