Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Suppress form repaints during calculations
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:
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.
Also note that the final call of LockWindowUpdate(0) - which is required to unlock
updates - will cause a lot of flicker as it repaints all application's visible windows/ controls.
Use this function with care only when absolutely necessary.
 | |  | | LockWindowUpdate(MainForm.Handle);
LockWindowUpdate(0); | |  | |  |
Comments:
|