Skip to content

VclStylesPreview

Rodrigo Ruz edited this page Mar 27, 2019 · 3 revisions

The TVclStylesPreview Component included in the Vcl.Styles.Ext unit allow you preview a VCL Style from a file or resource.

Check the next sample code

 var 
  StyleName: string;
  SourceInfo: TSourceInfo;
  LStyle: TCustomStyleServices;
  FPreview: TVclStylesPreview;
 begin
  FPreview := TVclStylesPreview.Create(Self);
  FPreview.Parent := PanelPreview;
  FPreview.BoundsRect := PanelPreview.ClientRect;
  StyleName := 'Carbon';
 if (StyleName <>'') and (not SameText(StyleName, 'Windows')) then
 begin
   TStyleManager.StyleNames;//call DiscoverStyleResources
   LStyle := TStyleManager.Style[StyleName];
   FPreview.Caption := StyleName;
   FPreview.Style := LStyle;
   TVclStylesPreviewClass(FPreview).Paint;
 end;
 ....
 end;

https://github.com/RRUZ/vcl-styles-utils/blob/master/images/VCLStyles_Previewer.png

Check out a sample application here.

Clone this wiki locally