예제 #1
0
        public static Point GetValidLocationForDropDown(
            RadDirection popupDirection,
            Rectangle screenRect,
            Size popupSize,
            Rectangle ownerRect,
            int ownerOffset,
            ref bool corected)
        {
            Point        point      = RadPopupHelper.CalcLocation(popupDirection, popupSize, ownerRect, ownerOffset);
            Point        location   = point;
            RadDirection correction = popupDirection;
            Rectangle    rectangle  = new Rectangle(location, popupSize);

            if (RadPopupHelper.GetCorrectingDirection(rectangle, screenRect, ref correction))
            {
                location  = RadPopupHelper.CalcLocation(correction, popupSize, ownerRect, ownerOffset);
                rectangle = new Rectangle(location, popupSize);
                if (RadPopupHelper.GetCorrectingDirection(rectangle, screenRect, ref correction))
                {
                    location = point;
                }
                corected = true;
            }
            rectangle.Location = location;
            return(RadPopupHelper.EnsureBoundsInScreen(rectangle, screenRect).Location);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #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);
        }