Exemplo n.º 1
0
        /// <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
                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);
        }
        /// <summary>
        /// Perform actual selection of the item.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon instance.</param>
        public void KeyTipSelect(KryptonRibbon ribbon)
        {
            // If we are not selected then make us so
            if (_ribbon.SelectedTab != _target.RibbonTab)
            {
                _ribbon.SelectedTab = _target.RibbonTab;
            }

            // Switch focus to this view
            _ribbon.FocusView = _target;

            // Update key tips with those appropriate for this tab
            KeyTipMode mode = (_ribbon.RealMinimizedMode ? KeyTipMode.PopupMinimized : KeyTipMode.SelectedGroups);

            _ribbon.KeyTipMode = mode;
            _ribbon.SetKeyTips(_ribbon.GenerateKeyTipsForSelectedTab(), mode);
        }