I'm not sure if there's a Delphi-specific method to do this, but using the Win32 API, this is done through the WM_SETREDRAW
message.
Edit: Thanks to Ken White and Sertac Akyuz for the sample code below.
begin
// Defer updates
SendMessage(Handle, WM_SETREDRAW, WPARAM(False), 0);
try
// Create all your controls here
finally
// Make sure updates are re-enabled
SendMessage(Handle, WM_SETREDRAW, WPARAM(True), 0);
// Invalidate; // Might be required to reflect the changes
end;
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…