mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 12:14:45 +13:00
Merge pull request #208 from Petethegoat/master
Makes annotation hint text center on primary monitor
This commit is contained in:
commit
5fe5333c27
1 changed files with 11 additions and 3 deletions
|
@ -388,11 +388,19 @@ 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 textRectangle = new Rectangle(ScreenRectangle0Based.Width / 2 - rectWidth / 2, offset, rectWidth, rectHeight);
|
||||
Rectangle primaryScreenBounds = Screen.PrimaryScreen.Bounds;
|
||||
foreach(Screen screen in Screen.AllScreens)
|
||||
{
|
||||
if(screen.Bounds.Left < 0)
|
||||
{
|
||||
primaryScreenBounds.X -= screen.Bounds.Left;
|
||||
}
|
||||
}
|
||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), offset, rectWidth, rectHeight);
|
||||
|
||||
if (textRectangle.RectangleOffset(10).Contains(CurrentMousePosition0Based))
|
||||
{
|
||||
textRectangle.Y = ScreenRectangle0Based.Height - rectHeight - offset;
|
||||
textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset - offset;
|
||||
}
|
||||
|
||||
using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
|
||||
|
@ -446,4 +454,4 @@ private void DrawDot(Graphics g, Point pos, int size, Color color, bool border =
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue