public void ShowControl(RadDirection popupDirection, int ownerOffset) { if (this.Visible) return; bool corected = false; Point location = RadPopupHelper.GetValidLocationForDropDown(popupDirection, this.Size, this.OwnerElement, ownerOffset, ref corected); if (this.grip != null) { if (corected) DockLayoutPanel.SetDock(grip, Telerik.WinControls.Layouts.Dock.Top); else DockLayoutPanel.SetDock(grip, Telerik.WinControls.Layouts.Dock.Bottom); } this.Location = location; this.AutoUpdateBounds(); if (this.AnimationEnabled) { this.AnimateDropDown(true); } else { this.Show(); } }
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); }
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); }
/// <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); }
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); }
public static Screen GetScreen(Point pointInScreen) { Screen primaryScreen = Screen.PrimaryScreen; for (int index = 0; index < Screen.AllScreens.Length; ++index) { if (RadPopupHelper.GetScreenBounds(Screen.AllScreens[index]).Contains(pointInScreen)) { return(Screen.AllScreens[index]); } } return(primaryScreen); }
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); }
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)); }
public static bool SetVisibleCore(Control control, IntPtr parentForm) { RadPopupHelper.SetWindowPosition(control.Handle, parentForm); Telerik.WinControls.NativeMethods.ShowWindow(control.Handle, 8); return(true); }
public static bool SetVisibleCore(Control control) { RadPopupHelper.SetVisibleCore(control, (IntPtr)Telerik.WinControls.NativeMethods.HWND_TOPMOST); return(true); }
public static void SetTopMost(IntPtr handle) { RadPopupHelper.SetWindowPosition(handle, (IntPtr)Telerik.WinControls.NativeMethods.HWND_TOPMOST); }
public static Rectangle GetScreenRect(Point pointInScreen) { return(RadPopupHelper.GetScreenBounds(RadPopupHelper.GetScreen(pointInScreen), true)); }