During the start of my windows application, I have to make a call to a web service to retrieve some default data to load onto my application. During the load of the form, I
Something else must be setting the cursor. The code below sets a wait cursor when the timer starts, and then sets the cursor back to the previous value after the timer expires. It works as expected: the wait cursor remains throughout the interval. Of course, moving the cursor outside the form will show the cursor for whatever window the mouse cursor is over, but moving it back to my form shows the wait cursor.
public partial class MyDialog : Form
{
private Timer myTimer;
public MyDialog()
{
InitializeComponent();
myTimer = new Timer();
myTimer.Tick += new EventHandler(myTimer_Tick);
myTimer.Interval = 5000;
myTimer.Enabled = false;
}
private Cursor SaveCursor;
private void button1_Click(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
myTimer.Enabled = true;
}
void myTimer_Tick(object sender, EventArgs e)
{
Cursor = SaveCursor;
myTimer.Enabled = false;
}
}