ComponentFactory.Krypton.Ribbon.VisualPopupGroup.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)
            {
                // Ensure the manager believes the mouse has left the area
                ViewManager.MouseLeave(EventArgs.Empty);

                // Do we need to restore the previous focus from the ribbon
                if (_restorePreviousFocus)
                    _ribbon.RestorePreviousFocus();

                // Mark the group as no longer showing as a popup
                _ribbonGroup.ShowingAsPopup = false;

                // Remove all child controls so they do not become disposed
                for (int i = Controls.Count - 1; i >= 0; i--)
                    Controls.RemoveAt(0);

                // If this group is being dismissed with key tips showing
                if (_ribbon.InKeyboardMode &&_ribbon.KeyTipMode == KeyTipMode.PopupGroup)
                {
                    // Revert back to key tips for selected tab
                    KeyTipMode mode = (_ribbon.RealMinimizedMode ? KeyTipMode.PopupMinimized : KeyTipMode.SelectedGroups);
                    _ribbon.KeyTipMode = mode;
                    _ribbon.SetKeyTips(_ribbon.GenerateKeyTipsForSelectedTab(), mode);
                }
            }

            base.Dispose(disposing);
        }