A caveat to using custom cursors with the WinForms Cursor class is that when using the stream, filename, and resource constructor overloads the supplied .cur file must be black and white in color.
Meaning that this will not work if the .cur files contains any colors besides black and white.
Cursor myCursor = new Cursor("myCursor.cur");
myControl.Cursor = myCursor;
There is a way around this limitation by using the Windows handle constructor overload:
Create the handle by using the Windows API:
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string fileName);
Then pass it to the appropriate Cursor constructor like this:
IntPtr handle = LoadCursorFromFile("myCursor.cur");
Cursor myCursor = new Cursor(handle);
myControl.Cursor = myCursor;
I hope this prevents others from scratching their heads to an ArgumentException being thrown stating: Image format is not valid. The image file may be corrupted. when using the other Cursor constructor overloads with a .cur file that contains color.