TSVGIconVirtualImageList
Unit: SVGIconVirtualImageList
Inherits from: TVirtualImageList (Delphi 10.3+) or TSVGIconImageListBase
Minimum Delphi Version: 10.3 Rio
Description
TSVGIconVirtualImageList is a virtual image list component that references a TSVGIconImageCollection to provide SVG icons at a specified size. Multiple virtual image lists can share the same icon collection, rendering icons at different sizes without duplicating storage.
This component integrates with Delphi's Virtual ImageList architecture (10.3+) and is fully compatible with all VCL controls that support TImageList.
Published Properties
Image Source
ImageCollection
property ImageCollection: TSVGIconImageCollection;Reference to the source icon collection.
Usage:
SVGIconVirtualImageList1.ImageCollection := SVGIconImageCollection1;Size Properties
Size
property Size: Integer;Uniform size for square icons (sets both Width and Height). Default: 16
Usage:
SVGIconVirtualImageList1.Size := 32;Width / Height
property Width: Integer;
property Height: Integer;Individual width and height for non-square icons. Default: 16
Usage:
SVGIconVirtualImageList1.Width := 48;
SVGIconVirtualImageList1.Height := 32;Rendering Attributes
Opacity
property Opacity: Byte;Opacity level for rendered icons (0-255). Default: 255
FixedColor
property FixedColor: TColor;Override color for rendering. Default: SVG_INHERIT_COLOR
GrayScale
property GrayScale: Boolean;Render icons in grayscale. Default: False
AntiAliasColor
property AntiAliasColor: TColor;Background color for anti-aliasing. Default: clBtnFace
ApplyFixedColorToRootOnly
property ApplyFixedColorToRootOnly: Boolean;Apply FixedColor only to root SVG elements. Default: False
Disabled State
DisabledGrayScale
property DisabledGrayScale: Boolean;Render disabled icons in grayscale. Default: True
DisabledOpacity
property DisabledOpacity: Byte;Opacity for disabled icons. Default: 125
DPI Scaling
Scaled
property Scaled: Boolean;Enable automatic DPI scaling. Default: True
Events
OnChange
property OnChange: TNotifyEvent;Fired when the image list changes.
Public Methods
Create (Delphi 10.3+)
constructor Create(AOwner: TComponent);Examples
Basic Setup
procedure TForm1.FormCreate(Sender: TObject);
begin
// Create collection with icons
SVGIconImageCollection1.LoadFromFiles(IconFiles);
// Small icons for toolbar
SVGIconVirtualImageListSmall.ImageCollection := SVGIconImageCollection1;
SVGIconVirtualImageListSmall.Size := 16;
ToolBar1.Images := SVGIconVirtualImageListSmall;
// Large icons for ribbon
SVGIconVirtualImageListLarge.ImageCollection := SVGIconImageCollection1;
SVGIconVirtualImageListLarge.Size := 48;
Ribbon1.Images := SVGIconVirtualImageListLarge;
end;Multiple Sizes from One Collection
// Same icons, three different sizes
procedure TForm1.SetupImageLists;
begin
// 16x16 for menus and toolbars
VirtualImageList16.ImageCollection := IconCollection;
VirtualImageList16.Size := 16;
// 32x32 for buttons
VirtualImageList32.ImageCollection := IconCollection;
VirtualImageList32.Size := 32;
// 64x64 for large displays
VirtualImageList64.ImageCollection := IconCollection;
VirtualImageList64.Size := 64;
// All share the same SVG sources, minimal memory overhead
end;Theme-Aware Virtual List
procedure TForm1.UpdateTheme(AIsDark: Boolean);
begin
if AIsDark then
begin
SVGIconVirtualImageList1.FixedColor := clWhite;
SVGIconVirtualImageList1.AntiAliasColor := $202020;
end
else
begin
SVGIconVirtualImageList1.FixedColor := clBlack;
SVGIconVirtualImageList1.AntiAliasColor := clWhite;
end;
Invalidate; // Refresh controls
end;