/// <summary> /// Generate a key tip info for each visible tab. /// </summary> /// <param name="ownerForm">KryptonForm instance that owns this view.</param> /// <returns>Array of KeyTipInfo instances.</returns> public KeyTipInfo[] GetQATKeyTips(KryptonForm ownerForm) { // Create all the list of all possible QAT key tip strings Stack <string> keyTipsPool = new Stack <string>(); // Then use the alphanumeric 0A - 0Z for (int i = 25; i >= 0; i--) { keyTipsPool.Push("0" + (char)(65 + i)); } // Then use the number 09 - 01 for (int i = 1; i <= 9; i++) { keyTipsPool.Push("0" + i.ToString()); } // Start with the number 1 - 9 for (int i = 9; i >= 1; i--) { keyTipsPool.Push(i.ToString()); } // If integrated into the caption area then get the caption area height Padding borders = Padding.Empty; if ((ownerForm != null) && !ownerForm.ApplyComposition) { borders = ownerForm.RealWindowBorders; } KeyTipInfoList keyTipList = new KeyTipInfoList(); foreach (ViewBase child in this) { // If visible and we have another key tip available on stack if (child.Visible && (keyTipsPool.Count > 0) && (child is ViewDrawRibbonQATButton)) { // Cast to correct type ViewDrawRibbonQATButton viewQAT = (ViewDrawRibbonQATButton)child; // Get the screen location of the view tab Rectangle viewRect = ParentControl.RectangleToScreen(viewQAT.ClientRectangle); // The keytip should be centered on the bottom center of the view Point screenPt = new Point((viewRect.Left + (viewRect.Width / 2)) - borders.Left, viewRect.Bottom - 2 - borders.Top); // Create new key tip that invokes the qat controller keyTipList.Add(new KeyTipInfo(viewQAT.Enabled, keyTipsPool.Pop(), screenPt, viewQAT.ClientRectangle, viewQAT.KeyTipTarget)); } } // If we have the extra button and it is in overflow appearance if ((_extraButton != null) && _extraButton.Overflow) { // Get the screen location of the extra button Rectangle viewRect = ParentControl.RectangleToScreen(_extraButton.ClientRectangle); // The keytip should be centered on the bottom center of the view Point screenPt = new Point((viewRect.Left + (viewRect.Width / 2)) - borders.Left, viewRect.Bottom - 2 - borders.Top); // Create fixed key tip of '00' that invokes the extra button contoller keyTipList.Add(new KeyTipInfo(true, "00", screenPt, _extraButton.ClientRectangle, _extraButton.KeyTipTarget)); } return(keyTipList.ToArray()); }