Rectangle annotate tip changes

This commit is contained in:
Jaex 2014-07-10 06:11:30 +03:00
parent 66db9ddf67
commit 1e78d98928
2 changed files with 12 additions and 7 deletions

View file

@ -107,7 +107,7 @@ private set
} }
} }
public RectangleAnnotateOptions Options; public RectangleAnnotateOptions Options { get; private set; }
private Timer timer; private Timer timer;
private Image backgroundImage; private Image backgroundImage;
@ -372,7 +372,7 @@ protected override void OnPaint(PaintEventArgs e)
private void DrawTips(Graphics g) private void DrawTips(Graphics g)
{ {
int offset = 10; int offset = 10;
int padding = 2; int padding = 3;
string tipText; string tipText;
@ -396,15 +396,18 @@ private void DrawTips(Graphics g)
} }
using (GraphicsPath backgroundPath = new GraphicsPath()) using (GraphicsPath backgroundPath = new GraphicsPath())
using (Brush brush = new SolidBrush(Color.FromArgb(150, Color.White))) using (Brush brush = new SolidBrush(Color.FromArgb(175, Color.White)))
using (Pen pen = new Pen(Color.FromArgb(150, Color.Black))) using (Pen pen = new Pen(Color.FromArgb(175, Color.Black)))
{ {
backgroundPath.AddRoundedRectangle(textRectangle, 5); backgroundPath.AddRoundedRectangle(textRectangle, 5);
g.FillPath(brush, backgroundPath); g.FillPath(brush, backgroundPath);
g.DrawPath(pen, 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) private void DrawRectangleInfo(Graphics g)

View file

@ -37,7 +37,7 @@ namespace ScreenCaptureLib
{ {
public class RectangleLight : Form public class RectangleLight : Form
{ {
public static Rectangle LastSelectionRectangle0Based; public static Rectangle LastSelectionRectangle0Based { get; private set; }
public Rectangle ScreenRectangle { get; private set; } public Rectangle ScreenRectangle { get; private set; }
@ -131,10 +131,12 @@ private void InitializeComponent()
Text = "ShareX - Rectangle Capture Light"; Text = "ShareX - Rectangle Capture Light";
ShowInTaskbar = false; ShowInTaskbar = false;
TopMost = true; TopMost = true;
Shown += RectangleLight_Shown; Shown += RectangleLight_Shown;
KeyUp += RectangleLight_KeyUp; KeyUp += RectangleLight_KeyUp;
MouseDown += RectangleLight_MouseDown; MouseDown += RectangleLight_MouseDown;
MouseUp += RectangleLight_MouseUp; MouseUp += RectangleLight_MouseUp;
ResumeLayout(false); ResumeLayout(false);
} }
@ -228,7 +230,7 @@ protected override void OnPaint(PaintEventArgs e)
using (Font font = new Font("Arial", 17, FontStyle.Bold)) 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); SelectionRectangle.Width, SelectionRectangle.Height), position, font, Color.White, Color.Black);
} }
} }