From 8471c79533cd587b45a3843fbd8f2dd35f8908e0 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 14 Feb 2012 11:23:48 +0000 Subject: [PATCH] Fixed possible issue when screen layout causes negative coordinates! git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1659 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Forms/CaptureForm.cs | 38 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/Greenshot/Forms/CaptureForm.cs b/Greenshot/Forms/CaptureForm.cs index 09eb23e20..06a5cb451 100644 --- a/Greenshot/Forms/CaptureForm.cs +++ b/Greenshot/Forms/CaptureForm.cs @@ -438,27 +438,25 @@ namespace Greenshot.Forms { } } } else { - if (cursorPos.X >= 0 || cursorPos.Y >= 0) { - if (!conf.OptimizeForRDP) { - using (Pen pen = new Pen(Color.LightSeaGreen)) { - pen.DashStyle = DashStyle.Dot; - Rectangle screenBounds = capture.ScreenBounds; - graphics.DrawLine(pen, cursorPos.X, screenBounds.Y, cursorPos.X, screenBounds.Height); - graphics.DrawLine(pen, screenBounds.X, cursorPos.Y, screenBounds.Width, cursorPos.Y); - } + if (!conf.OptimizeForRDP) { + using (Pen pen = new Pen(Color.LightSeaGreen)) { + pen.DashStyle = DashStyle.Dot; + Rectangle screenBounds = capture.ScreenBounds; + graphics.DrawLine(pen, cursorPos.X, screenBounds.Y, cursorPos.X, screenBounds.Height); + graphics.DrawLine(pen, screenBounds.X, cursorPos.Y, screenBounds.Width, cursorPos.Y); + } - string xy = cursorPos.X + " x " + cursorPos.Y; - using (Font f = new Font(FontFamily.GenericSansSerif, 8)) { - Size xySize = TextRenderer.MeasureText(xy, f); - using (GraphicsPath gp = Drawing.RoundedRectangle.Create2(cursorPos.X + 5, cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3)) { - using (Brush bgBrush = new SolidBrush(Color.FromArgb(200, 217, 240, 227))) { - graphics.FillPath(bgBrush, gp); - } - using (Pen pen = new Pen(Color.SeaGreen)) { - graphics.DrawPath(pen, gp); - Point coordinatePosition = new Point(cursorPos.X + 5, cursorPos.Y + 5); - graphics.DrawString(xy, f, pen.Brush, coordinatePosition); - } + string xy = cursorPos.X + " x " + cursorPos.Y; + using (Font f = new Font(FontFamily.GenericSansSerif, 8)) { + Size xySize = TextRenderer.MeasureText(xy, f); + using (GraphicsPath gp = Drawing.RoundedRectangle.Create2(cursorPos.X + 5, cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3)) { + using (Brush bgBrush = new SolidBrush(Color.FromArgb(200, 217, 240, 227))) { + graphics.FillPath(bgBrush, gp); + } + using (Pen pen = new Pen(Color.SeaGreen)) { + graphics.DrawPath(pen, gp); + Point coordinatePosition = new Point(cursorPos.X + 5, cursorPos.Y + 5); + graphics.DrawString(xy, f, pen.Brush, coordinatePosition); } } }