changeset 74:8f31b164ce7e

FBGUI: Added invisible cursor support
author Ivo Smits <Ivo@UCIS.nl>
date Thu, 28 Nov 2013 13:19:41 +0100
parents 6aca18ee4ec6
children 4e4c600031e2
files FBGUI/FBGUI.cs
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/FBGUI/FBGUI.cs	Sat Nov 02 16:01:09 2013 +0100
+++ b/FBGUI/FBGUI.cs	Thu Nov 28 13:19:41 2013 +0100
@@ -589,10 +589,11 @@
 		public FBGCursor(Image image, Point hotspot) {
 			this.Image = image;
 			this.Hotspot = hotspot;
-			this.Size = image.Size;
+			this.Size = image == null ? Size.Empty : image.Size;
 		}
 		public Rectangle Area { get { return new Rectangle(-Hotspot.X, -Hotspot.Y, Size.Width, Size.Height); } }
 		public FBGCursor RotateFlip(RotateFlipType type) {
+			if (Image == null) return this;
 			Image img = new Bitmap(Image);
 			img.RotateFlip(type);
 			Point hs = Hotspot;
@@ -617,6 +618,7 @@
 			}
 		}
 
+		public static readonly FBGCursor None = new FBGCursor(null, Point.Empty);
 		public static readonly FBGCursor Arrow = LoadFromResource("cursor_arrow", 0, 0);
 		public static readonly FBGCursor Move = LoadFromResource("cursor_move", 8, 8);
 		public static readonly FBGCursor SizeLeft = LoadFromResource("cursor_left", 1, 10);
@@ -755,7 +757,7 @@
 		}
 		public virtual new void Paint(Graphics g) {
 			HandleEvent(new FBGPaintEvent(g));
-			if (cursor != null) {
+			if (cursor != null && cursor.Image != null) {
 				Rectangle r = cursor.Area;
 				r.Offset(cursorposition);
 				g.DrawImage(cursor.Image, r);