mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
RectangleAnnotate changes
This commit is contained in:
parent
5fe5333c27
commit
adb27c3391
2 changed files with 18 additions and 10 deletions
|
@ -84,11 +84,26 @@ public static Rectangle GetActiveScreenBounds()
|
|||
return Screen.FromPoint(GetCursorPosition()).Bounds;
|
||||
}
|
||||
|
||||
public static Rectangle GetPrimaryScreenBounds()
|
||||
{
|
||||
return Screen.PrimaryScreen.Bounds;
|
||||
}
|
||||
|
||||
public static Rectangle GetScreenBounds0Based()
|
||||
{
|
||||
return ScreenToClient(GetScreenBounds());
|
||||
}
|
||||
|
||||
public static Rectangle GetActiveScreenBounds0Based()
|
||||
{
|
||||
return ScreenToClient(GetActiveScreenBounds());
|
||||
}
|
||||
|
||||
public static Rectangle GetPrimaryScreenBounds0Based()
|
||||
{
|
||||
return ScreenToClient(GetPrimaryScreenBounds());
|
||||
}
|
||||
|
||||
public static Point ScreenToClient(Point p)
|
||||
{
|
||||
int screenX = NativeMethods.GetSystemMetrics(SystemMetric.SM_XVIRTUALSCREEN);
|
||||
|
|
|
@ -388,19 +388,12 @@ private void DrawTips(Graphics g)
|
|||
Size textSize = g.MeasureString(tipText, tipFont).ToSize();
|
||||
int rectWidth = textSize.Width + padding * 2;
|
||||
int rectHeight = textSize.Height + padding * 2;
|
||||
Rectangle primaryScreenBounds = Screen.PrimaryScreen.Bounds;
|
||||
foreach(Screen screen in Screen.AllScreens)
|
||||
{
|
||||
if(screen.Bounds.Left < 0)
|
||||
{
|
||||
primaryScreenBounds.X -= screen.Bounds.Left;
|
||||
}
|
||||
}
|
||||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), offset, rectWidth, rectHeight);
|
||||
|
||||
if (textRectangle.RectangleOffset(10).Contains(CurrentMousePosition0Based))
|
||||
{
|
||||
textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset - offset;
|
||||
textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset;
|
||||
}
|
||||
|
||||
using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
|
||||
|
@ -454,4 +447,4 @@ private void DrawDot(Graphics g, Point pos, int size, Color color, bool border =
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue