From 6f71ede67e242652d299d3cd96efdaecd59d38a3 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Thu, 21 Mar 2019 13:45:21 -0700 Subject: [PATCH] Fix IBeam cursor change. --- .../Capture/CursorIconWatcher.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Remotely_ScreenCast/Capture/CursorIconWatcher.cs b/Remotely_ScreenCast/Capture/CursorIconWatcher.cs index 96347ddd..2c0fd667 100644 --- a/Remotely_ScreenCast/Capture/CursorIconWatcher.cs +++ b/Remotely_ScreenCast/Capture/CursorIconWatcher.cs @@ -90,18 +90,19 @@ namespace Remotely_ScreenCast.Capture if (currentCursor == Cursors.IBeam.Handle.ToString()) { OnChange?.Invoke(this, new CursorInfo(new byte[0], Point.Empty, "text")); - return; } - - using (var icon = Icon.FromHandle(cursorInfo.hCursor)) + else { - using (var ms = new MemoryStream()) + using (var icon = Icon.FromHandle(cursorInfo.hCursor)) { - using (var cursor = new Cursor(cursorInfo.hCursor)) + using (var ms = new MemoryStream()) { - var hotspot = cursor.HotSpot; - icon.ToBitmap().Save(ms, ImageFormat.Png); - OnChange?.Invoke(this, new CursorInfo(ms.ToArray(), hotspot)); + using (var cursor = new Cursor(cursorInfo.hCursor)) + { + var hotspot = cursor.HotSpot; + icon.ToBitmap().Save(ms, ImageFormat.Png); + OnChange?.Invoke(this, new CursorInfo(ms.ToArray(), hotspot)); + } } } }