TdxVisualRefinements.BeginUpdate Method
Postpones all control redraw operations that reflect global padding changes until an EndUpdate procedure is called.
Declaration
class procedure BeginUpdate; static;
Remarks
Every time a HeaderPadding, Padding, LightBorders, or UsePaddingForStandaloneEditors property value changes, all affected DevExpress controls redraw themselves to reflect the change. Enclose multiple global visual changes between BeginUpdate
and EndUpdate procedure calls to avoid excessive redraw operations.
BeginUpdate/EndUpdate and Batch Changes
A BeginUpdate
procedure call disables notifications and postpones all changes until an EndUpdate call. A subsequent EndUpdate call does the following:
- Re-enables change notifications and the corresponding redraw operations
- Applies all changes made after a
BeginUpdate
call - Sends the corresponding notifications in a batch
- Redraws all affected DevExpress controls
Note
Ensure that every BeginUpdate
procedure call is followed by an EndUpdate call, even if an exception occurs. Otherwise, your application’s UI remains frozen and unresponsive.
Code Example
The following code example adds 5
pixels to left and right paddings, and 2
pixels to top and bottom paddings in container controls and standalone editors:
uses
Forms,
cxLookAndFeels, // Adds the cxLookAndFeels unit to use the TdxVisualRefinements class
// ...
begin
TdxVisualRefinements.BeginUpdate; // Initiates the following batch change
try
TdxVisualRefinements.Padding := Rect(5, 2, 5, 2);
TdxVisualRefinements.UsePaddingForStandaloneEditors := True;
finally
TdxVisualRefinements.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TMyForm, MyForm);
Application.Run;
end.