# HG changeset patch # User Ivo Smits # Date 1385641181 -3600 # Node ID 8f31b164ce7e6b3e653d819889b703667299a464 # Parent 6aca18ee4ec6aea194506d8b6f2931a9482ed146 FBGUI: Added invisible cursor support diff -r 6aca18ee4ec6 -r 8f31b164ce7e FBGUI/FBGUI.cs --- 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);