Skip to main content
All docs
V25.2
  • TcxImageListSVGOptions.UseRegularAsLarge Property

    Specifies if the same SVG image list is the source of both regular and large UI element icons.

    Declaration

    property UseRegularAsLarge: Boolean read; write;

    Property Value

    Type Default Description
    Boolean True
    True
    An image list with SVG images assigned as the source of small UI element icons also serves as the source of large UI element icons.
    False
    Large and small UI elements use different source image lists.

    Remarks

    You can use the same set of SVG images as both small and large UI element icons because vector images scale up to any target size without quality losses.

    Common Property Behavior

    For example, if the UseRegularAsLarge property is set to True, an image list assigned to a bar manager‘s ImageOptions.Images or ImageOptions.DisabledImages property also serves as the icon source for the ImageOptions.LargeImages or ImageOptions.DisabledLargeImages property, respectively.

    Property Behavior in TcxButton

    OptionsImage.SVGOptions.UseRegularAsLarge and OptionsImage.SVGOptions.LargeSize properties allow you to define custom dimensions for an individual SVG glyph stored within an image list associated with the TcxButton component.

    This technique can be useful if you use a single image list populated with vector icons for all UI elements in an application.

    Code Example: Create Buttons with Different-Sized SVG Glyphs

    The following code example creates five buttons with different-sized SVG glyphs using a single image list as a glyph source:

    uses
      cxButtons,  // Declares the TcxButton class and related types
      cxGraphics;  // Declares the TcxImageList class and related types
    // ...
    
    procedure TMyForm.FormCreate(Sender: TObject);
    var
      AButton: TcxButton;
      ALargeGlyphSettings: TcxButtonImageOptions;
    begin
      AButton := TcxButton.Create(Self);  // Creates the large "Apply" button
      AButton.Parent := Self;  // Associates the created button with the form
      AButton.Caption := 'Apply';
      AButton.Font.Size := 20;
      // Position the button
      AButton.Top := 40;
      AButton.Left := 40;
      AButton.Height := 60;
      AButton.Width := 140;
      // Assign a glyph and configure related settings
      ALargeGlyphSettings := AButton.OptionsImage;
      ALargeGlyphSettings.Images := cxImageList1;
      ALargeGlyphSettings.ImageIndex := 0;
      ALargeGlyphSettings.SVGOptions.UseRegularAsLarge := True;
      ALargeGlyphSettings.SVGOptions.LargeSize.Width := 48;
      ALargeGlyphSettings.SVGOptions.LargeSize.Height := 48;
      AButton := TcxButton.Create(Self);  // Creates the large "Cancel" button
      AButton.Parent := Self; // Associates the created button with the form
      // Position the button
      AButton.Top := 40;
      AButton.Left := 200;
      AButton.Height := 60;
      AButton.Width := 60;
      AButton.PaintStyle := bpsGlyph;
      // Assign a glyph and configure related settings
      AButton.OptionsImage.Assign(ALargeGlyphSettings);  // Copies common settings from the "Apply" button
      AButton.OptionsImage.ImageIndex := 1;  // Assigns a different glyph from the source image list
      AButton := TcxButton.Create(Self);  // Creates the small "Refresh" button
      AButton.Parent := Self;  // Associates the created button with the form
      AButton.Caption := 'Refresh';
      AButton.Left := 40;  // Positions the button
      AButton.OptionsImage.Images := cxImageList1;
      AButton.OptionsImage.ImageIndex := 2;
      AButton := TcxButton.Create(Self);  // Creates the small "Add" button
      AButton.Parent := Self;  // Associates the created button with the form
      AButton.Caption := 'Add';
      AButton.Left := 115;  // Positions the button
      AButton.OptionsImage.Images := cxImageList1;
      AButton.OptionsImage.ImageIndex := 3;
      AButton := TcxButton.Create(Self); // Creates the small "Remove" button
      AButton.Parent := Self;  // Associates the created button with the form
      AButton.Caption := 'Remove';
      AButton.Left := 190;  // Positions the button
      AButton.OptionsImage.Images := cxImageList1;
      AButton.OptionsImage.ImageIndex := 4;
    end;
    

    VCL Editors: Five Buttons Using the Same Glyph Source

    Default Value

    The UseRegularAsLarge property’s default value is True.

    Default Value for TcxButton

    The TcxButton component uses False as the default UseRegularAsLarge property value.

    See Also