mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Move TryFixHandCursor to HelpersLib
This commit is contained in:
parent
82da3e353b
commit
d50d3ca7b8
2 changed files with 19 additions and 14 deletions
|
@ -1267,5 +1267,22 @@ public static string NumberToLetters(int num)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool TryFixHandCursor()
|
||||
{
|
||||
try
|
||||
{
|
||||
// https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423
|
||||
typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
?.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND)));
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If it fails, we'll just have to live with the old hand.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,7 +30,6 @@ You should have received a copy of the GNU General Public License
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
@ -291,7 +290,7 @@ private static void Run()
|
|||
|
||||
LanguageHelper.ChangeLanguage(Settings.Language);
|
||||
|
||||
TryFixHandCursor();
|
||||
Helpers.TryFixHandCursor();
|
||||
DebugHelper.WriteLine("MainForm init started.");
|
||||
MainForm = new MainForm();
|
||||
DebugHelper.WriteLine("MainForm init finished.");
|
||||
|
@ -504,7 +503,7 @@ private static bool CheckAdminTasks()
|
|||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
TryFixHandCursor();
|
||||
Helpers.TryFixHandCursor();
|
||||
Application.Run(new DNSChangerForm());
|
||||
return true;
|
||||
}
|
||||
|
@ -585,16 +584,5 @@ private static void CleanTempFiles()
|
|||
}
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private static void TryFixHandCursor()
|
||||
{
|
||||
try
|
||||
{
|
||||
// https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423
|
||||
typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
?.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND)));
|
||||
}
|
||||
catch { } // If it fails, we'll just have to live with the old hand.
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue