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
This commit is contained in:
RKrom 2012-02-14 11:23:48 +00:00
commit 8471c79533

View file

@ -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);
}
}
}