In .NET applications, we can set the Form.Cursor property to a Cursor object to change the Form’s cursor. The Cursor object can be created from four sources: a specified Windows Handle, a specified Data Stream, a specified File Name, or a specified ResourceType and CursorName. The following four constructor functions of Cursor are mapped to the above four object creation sources:
1. IntPtr
http://msdn.microsoft.com/en-us/library/a5bbc3fe.aspx
2. Stream
http://msdn.microsoft.com/en-us/library/7x58z7ya.aspx
3. String
http://msdn.microsoft.com/en-us/library/kkw8k45d.aspx
4. Typ, String
http://msdn.microsoft.com/en-us/library/kkw8k45d.aspx
Some system cursors cannot be loaded directly using the full path file name because they are in a native format which managed code is not aware of. In that case, we should call the Windows API LoadCursorFromFile using PInvoke, and then choose the first pattern to create a Cursor object from a File Handler. C# codes look like,
------------------------------------------------------------
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr LoadCursorFromFile(string path);
private void Form1_Load(object sender, EventArgs e) {
this.Cursor = new Cursor(LoadCursorFromFile(@"c:\windows\cursors\hand.cur"));
}
------------------------------------------------------------
Related threads:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/a4ea1a77-e286-40ba-a910-50834619b918
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/997eabe1-99a4-48cc-8223-f6ea3d1ff920
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/a5cd5452-c637-4c3f-9436-da06e68e6528
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/1c268a5f-e159-4890-bb03-19d4fb268c73
Please remember to mark the replies as answers if they help and unmark them if they provide no help.