Cursor does not change to WaitCursor over ListView when using delegate in C# MDI child form.

  • Thread starter Vladimir.Sakharuk
  • Start date
V

Vladimir.Sakharuk

I have MDI child form. It has detailed ListView control docked fill. On
Load event it set the cursor to wait. I have use 3 first lines together
or separate.

private void Form2_Load(object sender, System.EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
listView1.Cursor = Cursors.WaitCursor;
Cursor.Current = Cursors.WaitCursor;
RunAsyncCallDelegate msc = new RunAsyncCallDelegate(RunAsyncCall);
AsyncCallback cb = new AsyncCallback(RunAsyncCallback);
_asyncResult = msc.BeginInvoke(cb, null);
executionTimer.Enabled=true;
}

Than after a delegate returns I set the cursor back in a timer event.

private void executionTimer_Tick(object sender, System.EventArgs e)
{
if(_asyncResult.IsCompleted)
{
this.Cursor = Cursors.Default;
listView1.Cursor = Cursors.Default;
Cursor.Current = Cursors.Default;
}
}

The problem is follows:

During processing when Cursor is over listview it is Default cursor,
and not the WaitCursor.
When I change docked from fill the cursor over the form where no
listview is WaitCursor, but over listview is still Default.

If I remove delegate it does shows WaitCursor cursor but application is
frozen while it works(of cause) so it unacceptable.

Thank you
\/|ad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top