protected override void Dispose(bool disposing)
{
if (disposing)
{
if (_ribbonTextBox != null)
{
// Must unhook to prevent memory leaks
_ribbonTextBox.MouseEnterControl -= new EventHandler(OnMouseEnterControl);
_ribbonTextBox.MouseLeaveControl -= new EventHandler(OnMouseLeaveControl);
_ribbonTextBox.ViewPaintDelegate = null;
_ribbonTextBox.PropertyChanged -= new PropertyChangedEventHandler(OnTextBoxPropertyChanged);
_ribbon.ViewRibbonManager.LayoutAfter -= new EventHandler(OnLayoutAction);
_ribbon.ViewRibbonManager.LayoutBefore -= new EventHandler(OnLayoutAction);
// Remove association with definition
_ribbonTextBox.TextBoxView = null;
_ribbonTextBox = null;
}
}
base.Dispose(disposing);
}