How to force an repaint after a file open dialog

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

I'm having trouble with windows being left half drawn (for a while) after
the file open dialog is closed.

When the user selects a file in the file open dialog, the dialog closes and
the app starts to read the file (it takes about 5 seconds to read the file).
During the time that the app is reading the file however, the area that was
behind the file open dialog is not updated so it has a half drawn
appearance. How to I get the app window to repaint itself BEFORE it starts
the lengthy read operation. I've tried the Update and Invalidate methods,
but the problem remains.

Thanks

Mitch
 
I'm having trouble with windows being left half drawn (for a while) after
the file open dialog is closed.

When the user selects a file in the file open dialog, the dialog closes and
the app starts to read the file (it takes about 5 seconds to read the file).
During the time that the app is reading the file however, the area that was
behind the file open dialog is not updated so it has a half drawn
appearance. How to I get the app window to repaint itself BEFORE it starts
the lengthy read operation. I've tried the Update and Invalidate methods,
but the problem remains.

Start up a seperate thread to read the file data in. That way, the UI
thread can respond to the repaint message sent to it after the file open
dialog is closed.
 
Mitch said:
appearance. How to I get the app window to repaint itself BEFORE it starts
the lengthy read operation. I've tried the Update and Invalidate methods,
but the problem remains.

Maybe it helps to call Application.DoEvents
 
A separate thread is a good idea. Especially if the read time starts to
exceed 10 seconds.

The Application.DoEvents also worked well.

Thanks for the help.
 
Back
Top