Friday, June 15, 2007

The correct way to repaint a form or control in c#

There are two ways to repaint a form and its contents:

The Invalidate method governs what gets painted or repainted. The Update method governs when the painting or repainting occurs. If you use the Invalidate and Update methods together rather than calling Refresh, what gets repainted depends on which overload of Invalidate you use. The Update method just forces the control to be painted immediately, but the Invalidate method governs what gets painted when you call the Update method.

(Above info quoted from MSDN http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.update.aspx)