2005. november 6., vasárnap

Suppress form repaints during calculations


Problem/Question/Abstract:

Is there a way to stop an application from painting during heavy calculations?

Answer:

Call LockWindowUpdate() on your MainForm. Your form will not be redrawn and cannot be moved until you unlock it by passing 0 as the window handle.

Note that LockWindowUpdate() does not hide the form nor does it reset the WS_VISIBLE style bit.

  
LockWindowUpdate(MainForm.Handle); // pass the handle of window to lock

// heavy calculation here

LockWindowUpdate(0); // unlock it

Nincsenek megjegyzések:

Megjegyzés küldése