Merge pull request #208 from Petethegoat/master

Makes annotation hint text center on primary monitor
This commit is contained in:
Jaex 2014-07-26 22:28:08 +03:00
commit 5fe5333c27

View file

@ -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 =
}
}
}
}
}