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