I need to change the cursor in all windows, not just in the application, i have try this:
this.Cursor = Cursors.WaitCursor;
And this:
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
But it only changes the cursor in my application.
Any idea?
Customizing cursors Step 1: Navigate to the Mouse properties window as we did earlier. Step 2: Select the Pointers tab. Step 3: To select a custom cursor for the highlighted individual icon, click Browse. Step 4: That will open the default cursors folder, where hundreds of different cursor options are available.
Assuming you have your own cursor file (.cur) to apply you could hack this.
First you will have to change thje default Arrow cursor in the Registry, then you will need to call some P-Invoke to allow the OS to update the current sytem paramerters so the cursor actually changes.
Somthing like:
private void ChangeCursor(string curFile)
{
Registry.SetValue(@"HKEY_CURRENT_USER\Control Panel\Cursors\", "Arrow", curFile);
SystemParametersInfo(SPI_SETCURSORS, 0, null, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
const int SPI_SETCURSORS = 0x0057;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDCHANGE = 0x02;
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint? pvParam, uint fWinIni);
Usage:
ChangeCursor(@"C:\MyCursor.cur");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With