Exemple #1
0
        /// <summary>
        /// Show the tooltip popup relative to the provided screen position.
        /// </summary>
        /// <param name="screenRect">Screen position to display relative to.</param>
        public void ShowCalculatingSize(Rectangle screenRect)
        {
            // Get the size the popup would like to be
            Size popupSize = ViewManager.GetPreferredSize(Renderer, Size.Empty);

            // Find the screen position the popup will be relative to
            screenRect = new Rectangle(screenRect.X, screenRect.Y - VERT_OFFSET,
                                       screenRect.Width, screenRect.Height + (VERT_OFFSET * 2));

            // Show it now!
            Show(screenRect, popupSize);
        }
Exemple #2
0
        /// <summary>
        /// Show the tooltip popup relative to the provided screen position.
        /// </summary>
        /// <param name="screenPt">Screen point of cursor.</param>
        public void ShowCalculatingSize(Point screenPt)
        {
            // Get the size the popup would like to be
            Size popupSize = ViewManager.GetPreferredSize(Renderer, Size.Empty);

            // Find the screen position the popup will be relative to
            Rectangle screenRect = new Rectangle(screenPt.X + HORZ_OFFSET - (popupSize.Width / 2),
                                                 screenPt.Y - VERT_OFFSET,
                                                 1, VERT_OFFSET * 2);

            // Show it now!
            Show(screenRect, popupSize);
        }
Exemple #3
0
        /// <summary>
        /// Get the preferred size of the control based on a proposed size.
        /// </summary>
        /// <param name="proposedSize">Starting size proposed by the caller.</param>
        /// <returns>Calculated preferred size.</returns>
        public override Size GetPreferredSize(Size proposedSize)
        {
            // Do we have a manager to ask for a preferred size?
            if (ViewManager != null)
            {
                // Ask the view to peform a layout
                Size retSize = ViewManager.GetPreferredSize(Renderer, proposedSize);

                // Apply the maximum sizing
                if (MaximumSize.Width > 0)
                {
                    retSize.Width = Math.Min(MaximumSize.Width, retSize.Width);
                }
                if (MaximumSize.Height > 0)
                {
                    retSize.Height = Math.Min(MaximumSize.Height, retSize.Width);
                }

                // Apply the minimum sizing
                if (MinimumSize.Width > 0)
                {
                    retSize.Width = Math.Max(MinimumSize.Width, retSize.Width);
                }
                if (MinimumSize.Height > 0)
                {
                    retSize.Height = Math.Max(MinimumSize.Height, retSize.Height);
                }

                return(retSize);
            }
            else
            {
                // Fall back on default control processing
                return(base.GetPreferredSize(proposedSize));
            }
        }