Click here to Skip to main content
16,004,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am write this code in C# windows form...
C#
public void Form1_Load(object sender, EventArgs e)
        {

         Cursor.Current = new Cursor(@"C:\Cursor.ico");
        
        }

My code is run successfully no error occur. But Problem is icon not change,,
Posted
Updated 20-Oct-12 6:21am
v2

Try this:

C#
this.Cursor = new Cursor(@"C:\Cursor.cur");

Or:
C#
this.Cursor = Cursors.cursor;


But that isn't enough. You need to add this statement for all controls in your form.
 
Share this answer
 
v2
 
Share this answer
 
If you look at the definition of the Cursor constructor[^], it says very clearly:
"The fileName parameter must reference a standard cursor (.cur) file."
You are passing a .ICO file instead. Try a cursor instead of an icon!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900