Made the color picker placement logic work for all screens.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1656 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-13 16:18:33 +00:00
commit c1330fb88c

View file

@ -52,22 +52,29 @@ namespace Greenshot.Forms {
Point hs = Cursor.Current.HotSpot; Point hs = Cursor.Current.HotSpot;
Point zp = new Point(x, y); Point zp = new Point(x, y);
zp.X += cs.Width + 2 - hs.X; zp.X += cs.Width + 5 - hs.X;
zp.Y -= hs.Y; zp.Y += cs.Height + 5 - hs.Y;
if (zp.X < 0) { foreach (Screen screen in Screen.AllScreens) {
zp.X = 0; Rectangle screenRectangle = screen.Bounds;
} else if (zp.X + Width > Screen.PrimaryScreen.Bounds.Width) { if (screen.Bounds.Contains(x, y)) {
zp.X = x - Width - 2 - hs.X; if (zp.X < screenRectangle.X) {
zp.X = screenRectangle.X;
} else if (zp.X + Width > screenRectangle.X + screenRectangle.Width) {
zp.X = x - Width - 5 - hs.X;
} }
if (zp.Y < 0) { if (zp.Y < screenRectangle.Y) {
zp.Y = 0; zp.Y = screenRectangle.Y;
} else if (zp.Y + Height > Screen.PrimaryScreen.Bounds.Height) { } else if (zp.Y + Height > screenRectangle.Y + screenRectangle.Height) {
zp.Y = Screen.PrimaryScreen.Bounds.Height - Height; zp.Y = y - Height - 5 - hs.Y;
}
break;
}
} }
Location = zp; Location = zp;
Invalidate();
} }
public void setHotSpot(Point screenCoordinates) { public void setHotSpot(Point screenCoordinates) {
@ -88,6 +95,5 @@ namespace Greenshot.Forms {
} }
} }
} }
} }
} }