changeset 79:4e4c600031e2

Merge FBGUI updates
author Ivo Smits <Ivo@UCIS.nl>
date Sun, 16 Feb 2014 15:02:36 +0100
parents 1a10ca0f662e (current diff) 8f31b164ce7e (diff)
children 4714531734b3
files FBGUI/FBGUI.cs
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/FBGUI/FBGUI.cs	Sun Feb 16 14:59:52 2014 +0100
+++ b/FBGUI/FBGUI.cs	Sun Feb 16 15:02:36 2014 +0100
@@ -581,10 +581,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;
@@ -609,6 +610,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);
@@ -747,7 +749,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);