Skip to main content
All docs
V26.1
  • 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: Apply Custom Padding to All Editors

    The code example in this section adds 5 pixels to left and right paddings, and 2 pixels to top and bottom paddings in container controls and standalone editors.

    Open the Project Source to Edit the Main Function

    To open the main application unit of your project, you can use one of the following options:

    • Select ProjectView Source in the main menu of your RAD Studio IDE.
    • Select the target project in the Projects Window and press Ctrl + V (alternatively, you can display the context menu and select the View Source option).
    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.
    

    VCL Express Library: Data Grid with Custom Header and Cell Paddings

    See Also