private void CreateCursor(Stream stream) { InitFromStream(stream); this.shape = ToBitmap(true, false); this.mask = ToBitmap(false, false); handle = XplatUI.DefineCursor(shape, mask, Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 255), cursor_dir.idEntries[id].xHotspot, cursor_dir.idEntries[id].yHotspot); this.shape.Dispose(); this.shape = null; this.mask.Dispose(); this.mask = null; if (handle != IntPtr.Zero) { this.cursor = ToBitmap(true, true); } }