Skip to content

VclStylesPreview

Rodrigo Ruz edited this page Apr 30, 2015 · 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://dl.dropboxusercontent.com/u/12733424/Blog/VCl%20Utils/VCLStyles_Previewer.png

Check out a sample application here.

Clone this wiki locally