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