Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Updating = false 2

Status
Not open for further replies.

PeteG

Programmer
Feb 23, 2001
144
GB
Hi,
I recall from VB/VBA that, when working with forms, you could switch the screen updating off when performing some long process and then switch it back on again, the point being that the code would run faster as it didn't have to keep re-drawing the form - also the app's appearance would be better as you wouldn't be left with a 'half-drawn' form image as the processing was being carried out.

Is there something similar in C#?

Cheers

Pete
 
I don't see anything in the Forms class about this. You could probably do something like disable the form (using .Enable = false), update it's contents, and re-enable it.

Or you could probably use the traditional WinAPI method.

Chip H.
 
System.Windows.Forms has two methods that can be used in tandem:

SuspendLayout() and ResumeLayout()

SuspendLayout suppress multiple Layout events while you adjust multiple attributes of the control. For example, you could call the SuspendLayout method, then set the Size, Location, Anchor, or Dock properties of the control, and then call the ResumeLayout method to allow the changes to take effect.
 
Thanks - that sounds like just the thing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top