Exemple #1
0
        internal void ShowInTaskbar(int x, int y)
        {
            base.WorkingAreaConstrained = false;
            Rectangle rect   = base.CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.AboveLeft);
            Rectangle bounds = Screen.FromRectangle(rect).Bounds;

            if (rect.Y < bounds.Y)
            {
                rect = base.CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.BelowLeft);
            }
            else if (rect.X < bounds.X)
            {
                rect = base.CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.AboveRight);
            }
            rect = WindowsFormsUtils.ConstrainToBounds(bounds, rect);
            base.Show(rect.X, rect.Y);
        }
        internal void ShowInTaskbar(int x, int y)
        {
            // we need to make ourselves a topmost window
            WorkingAreaConstrained = false;
            Rectangle bounds = CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.AboveLeft);
            Rectangle screenBounds = Screen.FromRectangle(bounds).Bounds;
            if (bounds.Y < screenBounds.Y)
            {
                bounds = CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.BelowLeft);
            }
            else if (bounds.X < screenBounds.X)
            {
                bounds = CalculateDropDownLocation(new Point(x, y), ToolStripDropDownDirection.AboveRight);
            }
            bounds = WindowsFormsUtils.ConstrainToBounds(screenBounds, bounds);

            Show(bounds.X, bounds.Y);
        }
Exemple #3
0
 /// <summary>
 ///  Given a rectangle, constrain it to fit onto the current screen.
 /// </summary>
 internal static Rectangle ConstrainToScreenBounds(Rectangle bounds)
 {
     return(ConstrainToBounds(Screen.FromRectangle(bounds).Bounds, bounds));
 }
Exemple #4
0
 public static Rectangle GetWorkingArea(Rectangle rect)
 {
     return(Screen.FromRectangle(rect).WorkingArea);
 }
Exemple #5
0
 public static Rectangle GetBounds(Rectangle rect)
 {
     return(Screen.FromRectangle(rect).Bounds);
 }