Freeze window during update?

  • Thread starter Thread starter David Veeneman
  • Start date Start date
D

David Veeneman

Is there any way to freeze a window during a complicated update? I have an
application which has to do a fairly complex update to its main window, It
doesn't take long, but it looks kind of sloppy to see parts of the screen
update sequentially. I'd like to freeze the display whhen updating begins,
then release it when the update is done. Can that be done easily? Thanks in
advance.
 
Thanks. I've never had much luck with SuspendLayout() / ResumeLayout(). But
I'll give it another try.
 
I think what you are referring to is Windows not having time to redraw during
your time consuming procedure. Two ways that I know of fixing this; one
being a lot more elegant than the other.

The best way is to perform you lengthy process in a background worker
thread. This keeps your main application thread responsive to redraws and
other items such as status updates from your background worker. When doing
this though you need to make sure that interface elements that should not be
run during the other lengthy process are disabled.

The other pretty bad way to be to sprinkle Application.DoEvents() in your
lengthy process, giving your interface a better chance to redraw.
 
Back
Top