C# Winforms - change cursor icon of mouse

后端 未结 2 1245
借酒劲吻你
借酒劲吻你 2020-12-18 18:04

How to change cursor icon to the \'busy icon\' usually shown on the desktop? How can i set Animated files (.gif,.ani) instead of cursor ?

相关标签:
2条回答
  • 2020-12-18 18:41

    I have the answer for a picturebox

    Picturebox1.cursor = new cursor(Properties.Resources.CURSOR NAME.GetHicon());
    
    0 讨论(0)
  • 2020-12-18 19:04

    Try to do the following:

    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
    

    More information is available at Cursors Class documentation

    Cursor class doesn't support GIF files or animated cursors (.ANI). You can load a custom cursor doing

    Cursor.Current = new Cursor("C:\\ic.cur");
    

    Maybe you can convert yout GIF file to cursor format using a tool like Microangelo. In addition, there is another thread related to it.

    How do you convert a GIF into a CUR file?

    0 讨论(0)
提交回复
热议问题