Cursors in Visual Studio in a Winforms app using C#

63 Views Asked by At

I want to change my cursor when I load frmCatch to this cursor: Application.StartupPath + @"\cursors\catch.ani".

I tried a lot of different options but it don't work.

I tried to use this code:

Cursor.Current = new Cursor(Application.StartupPath + @"\cursors\catch.ani");

And that is the error I get:

System.ArgumentException: Image format is not valid. The image file may be corrupted. (Parameter 'fileName')

1

There are 1 best solutions below

0
Fildor On

The Documentation on Cursor clearly states:

Note
Animated cursors (.ani files) are not supported by the Cursor class.

So, that's the reason why you encounter this error. You may want to use a standard cursor (.cur) file.