How to force screen update

  • Thread starter Thread starter Tim Johnson
  • Start date Start date
T

Tim Johnson

I know this has to be something really simple, but I have 2 questions:

1. How do you suppress painting of a form while doing some lengthy form_load
stuff? I get bits and pieces of the form showing up before the final form
appears.

2. How do you force a label text-change to appear immediately? I'm doing a
web-service call on a timer tick, and I don't want to use the wait-cursors.
So I update a status label with something like "Please wait...", then make
the web-service call, then update it with "Uploaded 10 records". Only the
2nd message appears. I've tried label.Invalidate() and this.Invalidate(),
with and without a Thread.Sleep(0). What am I missing?

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625
 
Tim Johnson said:
I know this has to be something really simple, but I have 2 questions:

1. How do you suppress painting of a form while doing some lengthy
form_load stuff? I get bits and pieces of the form showing up before the
final form appears.

Create a generic Controll that has size set to Form.ClientRectangle and
bring it to front. That should keep you form from displaying any controls.
If you want to get creative, ether implement soem custom painting on this
control, or use a picturebox
2. How do you force a label text-change to appear immediately? I'm doing
a web-service call on a timer tick, and I don't want to use the
wait-cursors. So I update a status label with something like "Please
wait...", then make the web-service call, then update it with "Uploaded 10
records". Only the 2nd message appears. I've tried label.Invalidate()
and this.Invalidate(), with and without a Thread.Sleep(0). What am I
missing?

Call Application.DoEvents
 
You can not suppress window changes redraw, since WM_SETREDRAW message
works for Combobox, Treeview, Listbox but not for a Form. But if you
want that your "Please wait..." message will display first on a form
then put it on the first line of form constructor and call
"Application.DoEvents" to process window message queue. It also applies
as an answer for the second question.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Back
Top