I'm having a form that takes a few seconds to finally display. This form is called through:
using (ResultsForm frm = new ResultsForm())
{
this.Visible = false;
frm.ShowDialog();
this.Visible = true;
}
It's useful that I get the default cursor to Cursors.WaitCursor
while waiting for the form to finally display. Currently I can only seem to be able to do this successfully by using the static 'Current' property:
using (ResultsForm frm = new ResultsForm())
{
//this.Visible = false;
Cursor.Current = Cursors.WaitCursor;
frm.ShowDialog();
//this.Visible = true;
}
But this has two problems:
- It forces me to disable the MainForm hiding feature which I would like to retain.
- It increases coupling since
Cursor.Current = Cursor.Default;
needs to be called within the ResultsForm Shown event.
How can I change the Cursor while the form loads without changing the first code snippet and while avoiding coupling?
UPDATE: Now the question was answered, video presentation was removed so I don't go over my ISP bandwidth limitations.
Why do you have to remove the this.Visible = false? You should still be able to do it while setting the cursor.
Would it be an acceptable solution to have the ResultsForm set the cursor instead of the parent form? Get it to set the cursor before it starts the code that takes all the time, then set it back at the end.