private void OnExtraButtonClick(object sender, EventHandler finishDelegate)
        {
            ViewDrawRibbonQATExtraButton button = (ViewDrawRibbonQATExtraButton)sender;

            // Convert the button rectangle to screen coordinates
            Rectangle screenRect = ParentControl.RectangleToScreen(button.ClientRectangle);

            if (_extraButton.Overflow)
            {
                Ribbon.DisplayQATOverflowMenu(screenRect, this, finishDelegate);
            }
            else
            {
                Ribbon.DisplayQATCustomizeMenu(screenRect, this, finishDelegate);
            }
        }
        /// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonQATContents class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon control instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        /// <param name="showExtraButton">Should the extra button be shown.</param>
        public ViewLayoutRibbonQATContents(KryptonRibbon ribbon,
                                           NeedPaintHandler needPaint,
                                           bool showExtraButton)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(needPaint != null);

            Ribbon     = ribbon;
            _needPaint = needPaint;

            // Create initial lookup table
            _qatButtonToView = new QATButtonToView();

            // Create the extra button for customization/overflow
            if (showExtraButton)
            {
                _extraButton = new ViewDrawRibbonQATExtraButton(ribbon, needPaint);
                _extraButton.ClickAndFinish += OnExtraButtonClick;
            }
        }
        /// <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)
            {
                Clear();

                foreach (ViewDrawRibbonQATButton view in _qatButtonToView.Values)
                {
                    view.Dispose();
                }

                _qatButtonToView.Clear();

                if (_extraButton != null)
                {
                    _extraButton.ClickAndFinish -= OnExtraButtonClick;
                    _extraButton = null;
                }
            }

            base.Dispose(disposing);
        }