/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing)
{
// Ensure the manager believes the mouse has left the area
ViewRibbonManager.MouseLeave(EventArgs.Empty);
// If this group is being dismissed with key tips showing
if (_ribbon.InKeyboardMode && _ribbon.KeyTipMode == KeyTipMode.PopupMinimized)
{
// Revert back to key tips for selected tab
_ribbon.KeyTipMode = KeyTipMode.Root;
_ribbon.SetKeyTips(_ribbon.GenerateKeyTipsAtTopLevel(), KeyTipMode.Root);
}
// Remove the collection of children elements, so they are not disposed,
// disposing them would cause the ones that have real Win32 controls to
// also dispose and we do not want that!
if (ViewManager != null)
{
ViewManager.ActiveView = null;
ViewManager.Root = new ViewLayoutNull();
}
// Remove all child controls so they do not become disposed
for (int i = Controls.Count - 1; i >= 0; i--)
{
Controls.RemoveAt(0);
}
}
base.Dispose(disposing);
}