From 1e78d98928214a2469eaa4dad00c34ea748939c7 Mon Sep 17 00:00:00 2001 From: Jaex Date: Thu, 10 Jul 2014 06:11:30 +0300 Subject: [PATCH] Rectangle annotate tip changes --- ScreenCaptureLib/Forms/RectangleAnnotate.cs | 13 ++++++++----- ScreenCaptureLib/Forms/RectangleLight.cs | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ScreenCaptureLib/Forms/RectangleAnnotate.cs b/ScreenCaptureLib/Forms/RectangleAnnotate.cs index 7e0157181..1e9bdcc1e 100644 --- a/ScreenCaptureLib/Forms/RectangleAnnotate.cs +++ b/ScreenCaptureLib/Forms/RectangleAnnotate.cs @@ -107,7 +107,7 @@ private set } } - public RectangleAnnotateOptions Options; + public RectangleAnnotateOptions Options { get; private set; } private Timer timer; private Image backgroundImage; @@ -372,7 +372,7 @@ protected override void OnPaint(PaintEventArgs e) private void DrawTips(Graphics g) { int offset = 10; - int padding = 2; + int padding = 3; string tipText; @@ -396,15 +396,18 @@ private void DrawTips(Graphics g) } using (GraphicsPath backgroundPath = new GraphicsPath()) - using (Brush brush = new SolidBrush(Color.FromArgb(150, Color.White))) - using (Pen pen = new Pen(Color.FromArgb(150, Color.Black))) + using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White))) + using (Pen pen = new Pen(Color.FromArgb(175, Color.Black))) { backgroundPath.AddRoundedRectangle(textRectangle, 5); g.FillPath(brush, backgroundPath); g.DrawPath(pen, backgroundPath); } - ImageHelpers.DrawTextWithShadow(g, tipText, new PointF(textRectangle.X + padding, textRectangle.Y + padding), tipFont, Color.Black, Color.WhiteSmoke); + using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }) + { + g.DrawString(tipText, tipFont, Brushes.Black, textRectangle, sf); + } } private void DrawRectangleInfo(Graphics g) diff --git a/ScreenCaptureLib/Forms/RectangleLight.cs b/ScreenCaptureLib/Forms/RectangleLight.cs index 63c9fcacf..acf59ba81 100644 --- a/ScreenCaptureLib/Forms/RectangleLight.cs +++ b/ScreenCaptureLib/Forms/RectangleLight.cs @@ -37,7 +37,7 @@ namespace ScreenCaptureLib { public class RectangleLight : Form { - public static Rectangle LastSelectionRectangle0Based; + public static Rectangle LastSelectionRectangle0Based { get; private set; } public Rectangle ScreenRectangle { get; private set; } @@ -131,10 +131,12 @@ private void InitializeComponent() Text = "ShareX - Rectangle Capture Light"; ShowInTaskbar = false; TopMost = true; + Shown += RectangleLight_Shown; KeyUp += RectangleLight_KeyUp; MouseDown += RectangleLight_MouseDown; MouseUp += RectangleLight_MouseUp; + ResumeLayout(false); } @@ -228,7 +230,7 @@ protected override void OnPaint(PaintEventArgs e) using (Font font = new Font("Arial", 17, FontStyle.Bold)) { - ImageHelpers.DrawTextWithOutline(g, string.Format("{0}, {1}\r\n{2} x {3}", SelectionRectangle.X, SelectionRectangle.Y, + ImageHelpers.DrawTextWithOutline(g, string.Format("X:{0} Y:{1}\r\n{2} x {3}", SelectionRectangle.X, SelectionRectangle.Y, SelectionRectangle.Width, SelectionRectangle.Height), position, font, Color.White, Color.Black); } }