Added CreateCursor method

This commit is contained in:
Jaex 2016-07-04 13:27:31 +03:00
parent 3bdd94b870
commit 37c4749cd0
6 changed files with 13 additions and 24 deletions

View file

@ -156,10 +156,7 @@ private void EventMouseEnter(object sender, EventArgs e)
{
if (this is ColorBox)
{
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
Cursor = Helpers.CreateCursor(Resources.Crosshair);
}
}

View file

@ -1120,5 +1120,13 @@ public static string GetWindowsProductName()
return Environment.OSVersion.VersionString;
}
public static Cursor CreateCursor(byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
return new Cursor(ms);
}
}
}
}

View file

@ -66,11 +66,7 @@ public BaseRegionForm()
InitializeComponent();
Icon = ShareXResources.Icon;
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
Cursor = Helpers.CreateCursor(Resources.Crosshair);
drawableObjects = new List<DrawableObject>();
Config = new RegionCaptureOptions();

View file

@ -89,11 +89,7 @@ public RectangleRegionAnnotateForm(RectangleAnnotateOptions options)
InitializeComponent();
Icon = ShareXResources.Icon;
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
Cursor = Helpers.CreateCursor(Resources.Crosshair);
timer = new Timer { Interval = 10 };
timer.Tick += timer_Tick;

View file

@ -69,11 +69,7 @@ public RectangleRegionLightForm()
InitializeComponent();
Icon = ShareXResources.Icon;
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
Cursor = Helpers.CreateCursor(Resources.Crosshair);
timer = new Timer { Interval = 10 };
timer.Tick += timer_Tick;

View file

@ -82,17 +82,13 @@ public RectangleRegionTransparentForm()
StartPosition = FormStartPosition.Manual;
Bounds = ScreenRectangle;
Text = "ShareX - " + Resources.RectangleTransparent_RectangleTransparent_Rectangle_capture_transparent;
Cursor = Helpers.CreateCursor(Resources.Crosshair);
Shown += RectangleTransparent_Shown;
KeyUp += RectangleTransparent_KeyUp;
MouseDown += RectangleTransparent_MouseDown;
MouseUp += RectangleTransparent_MouseUp;
using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
{
Cursor = new Cursor(cursorStream);
}
timer = new Timer { Interval = 10 };
timer.Tick += timer_Tick;
timer.Start();