mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Change the hand cursor only when we actually open a form
This commit is contained in:
parent
d8c2a7f796
commit
82da3e353b
1 changed files with 10 additions and 11 deletions
|
@ -237,13 +237,6 @@ private static void Main(string[] args)
|
||||||
CLI = new CLIManager(args);
|
CLI = new CLIManager(args);
|
||||||
CLI.ParseCommands();
|
CLI.ParseCommands();
|
||||||
|
|
||||||
// Fix the hand cursor before we open any form.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FixHandCursor();
|
|
||||||
}
|
|
||||||
catch (Exception) { } // If it fails, we'll just have to live with the old hand.
|
|
||||||
|
|
||||||
#if STEAM
|
#if STEAM
|
||||||
if (CheckUninstall()) return; // Steam will run ShareX with -Uninstall when uninstalling
|
if (CheckUninstall()) return; // Steam will run ShareX with -Uninstall when uninstalling
|
||||||
#endif
|
#endif
|
||||||
|
@ -298,6 +291,7 @@ private static void Run()
|
||||||
|
|
||||||
LanguageHelper.ChangeLanguage(Settings.Language);
|
LanguageHelper.ChangeLanguage(Settings.Language);
|
||||||
|
|
||||||
|
TryFixHandCursor();
|
||||||
DebugHelper.WriteLine("MainForm init started.");
|
DebugHelper.WriteLine("MainForm init started.");
|
||||||
MainForm = new MainForm();
|
MainForm = new MainForm();
|
||||||
DebugHelper.WriteLine("MainForm init finished.");
|
DebugHelper.WriteLine("MainForm init finished.");
|
||||||
|
@ -510,6 +504,7 @@ private static bool CheckAdminTasks()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
TryFixHandCursor();
|
||||||
Application.Run(new DNSChangerForm());
|
Application.Run(new DNSChangerForm());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -591,11 +586,15 @@ private static void CleanTempFiles()
|
||||||
}).Start();
|
}).Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FixHandCursor()
|
private static void TryFixHandCursor()
|
||||||
{
|
{
|
||||||
// https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423
|
try
|
||||||
typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static)
|
{
|
||||||
?.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND)));
|
// 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