Hi I have tried using the Cursor constructor by passing a file name to it and it fails when it is passed a valid cursor file.
The simple test code is as follows which changes the cursor property of panel on a form
Note that when passed an appropriate ICO file, it works, but fails when passed a CUR file.
usingSystem;
usingSystem.Windows.Forms;
namespacecursor_test
{
publicpartialclassForm1:Form
{
publicForm1()
{
InitializeComponent();
}
privateboolChangeCursor()
{
openFileDialog1.DefaultExt ="cur";
openFileDialog1.Filter ="Cursor|*.cur|Icon|*.ico";
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
stringfileName = openFileDialog1.FileName;
panel_Cursor.Cursor =newCursor(fileName);
MessageBox.Show(String.Concat("Cursor set to: ", fileName));
}
catch(ExceptionE)
{
MessageBox.Show(E.Message);
returnfalse;
}
returntrue;
}
returnfalse;
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
ChangeCursor();
}
}
}