ComponentFactory.Krypton.Ribbon.ViewDrawRibbonQATOverflow.GetPreferredSize C# (CSharp) Method

GetPreferredSize() public method

Discover the preferred size of the element.
public GetPreferredSize ( ViewLayoutContext context ) : Size
context ComponentFactory.Krypton.Toolkit.ViewLayoutContext Layout context.
return System.Drawing.Size
        public override Size GetPreferredSize(ViewLayoutContext context)
        {
            // Get size of the contained items
            Size preferredSize = base.GetPreferredSize(context);

            // Add on the border padding
            preferredSize = CommonHelper.ApplyPadding(Orientation.Horizontal, preferredSize, _borderPadding);
            preferredSize.Height = Math.Max(preferredSize.Height, QAT_HEIGHT_FULL);

            return preferredSize;
        }

Usage Example

示例#1
0
        /// <summary>
        /// Show the quick access toolbar popup relative to the parent area.
        /// </summary>
        /// <param name="parentScreenRect">Screen rectangle of the parent.</param>
        /// <param name="finishDelegate">Delegate fired when popup dismissed.</param>
        public void ShowCalculatingSize(Rectangle parentScreenRect,
                                        EventHandler finishDelegate)
        {
            Size popupSize;

            // Find the size the quick access toolbar requests to be
            using (ViewLayoutContext context = new ViewLayoutContext(this, Renderer))
                popupSize = _viewQAT.GetPreferredSize(context);

            DismissedDelegate = finishDelegate;

            // Request we be shown below the parent screen rect
            Show(parentScreenRect, popupSize);
        }