Ejemplo n.º 1
0
        public virtual void ShowDropDown(Point location)
        {
            Rectangle screenRect = RadPopupHelper.GetScreenRect((RadElement)this);
            Rectangle rectangle  = RadPopupHelper.EnsureBoundsInScreen(new Rectangle(location, this.menu.Size), screenRect);

            this.menu.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            this.menu.Show(rectangle.Location);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the drop down menu at given location
        /// </summary>
        /// <param name="location">The upper left corner of the drop down in screen coordinates</param>
        public virtual void ShowDropDown(Point location)
        {
            Rectangle screenRect = RadPopupHelper.GetScreenRect(this);
            Rectangle popupRect  = new Rectangle(location, this.menu.Size);
            Rectangle bounds     = RadPopupHelper.EnsureBoundsInScreen(popupRect, screenRect);

            this.menu.RightToLeft = (this.RightToLeft) ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;
            this.menu.Show(bounds.Location);
        }
Ejemplo n.º 3
0
        public static Rectangle GetScreenRect(RadElement elementOnScreen)
        {
            Rectangle rectangle = RadPopupHelper.GetScreenBounds(Screen.PrimaryScreen);

            if (elementOnScreen != null && elementOnScreen.ElementTree != null && elementOnScreen.ElementTree != null)
            {
                Point point   = new Point(elementOnScreen.Size.Width / 2, elementOnScreen.Size.Height / 2);
                Point control = elementOnScreen.PointToControl(point);
                rectangle = RadPopupHelper.GetScreenRect(elementOnScreen.ElementTree.Control.PointToScreen(control));
            }
            return(rectangle);
        }
Ejemplo n.º 4
0
        public static Point GetValidLocationForContextMenu(
            RadDirection popupDirection,
            Point location,
            Size popupSize,
            ref bool corected)
        {
            Rectangle screenRect = RadPopupHelper.GetScreenRect(location);
            Rectangle rectangle  = new Rectangle(location, popupSize);
            Point     point      = location;

            switch (popupDirection)
            {
            case RadDirection.Left:
                location = new Point(rectangle.Left - popupSize.Width, rectangle.Top);
                break;

            case RadDirection.Up:
                location = new Point(rectangle.Left, rectangle.Top - popupSize.Height);
                break;
            }
            if (RadPopupHelper.GetCorrectingDirection(rectangle, screenRect, ref popupDirection))
            {
                switch (popupDirection)
                {
                case RadDirection.Left:
                    location = new Point(rectangle.Left - popupSize.Width, rectangle.Top);
                    break;

                case RadDirection.Right:
                    location = new Point(rectangle.Right, rectangle.Top);
                    break;

                case RadDirection.Up:
                    location = new Point(rectangle.Left, rectangle.Top - popupSize.Height);
                    break;

                case RadDirection.Down:
                    location = new Point(rectangle.Left, rectangle.Bottom);
                    break;
                }
                rectangle = new Rectangle(location, popupSize);
                if (RadPopupHelper.GetCorrectingDirection(rectangle, screenRect, ref popupDirection))
                {
                    location = point;
                }
                corected = true;
            }
            rectangle.Location = location;
            rectangle          = RadPopupHelper.EnsureBoundsInScreen(rectangle, screenRect);
            return(rectangle.Location);
        }
Ejemplo n.º 5
0
        public static Point GetValidLocationForDropDown(
            RadDirection popupDirection,
            Size popupSize,
            RadElement owner,
            int ownerOffset,
            ref bool corected)
        {
            Rectangle screenRect = RadPopupHelper.GetScreenRect(owner);
            Rectangle rectangle  = owner.ControlBoundingRectangle;

            if (owner.ElementTree != null)
            {
                rectangle = owner.ElementTree.Control.RectangleToScreen(rectangle);
            }
            return(RadPopupHelper.GetValidLocationForDropDown(popupDirection, screenRect, popupSize, rectangle, ownerOffset, ref corected));
        }