I have an application written in delphi-xe2, now i'm adding VCL styles support, So i want to build a menu to choose the vcl style file to load and apply, this part is working fine , the menu is build in runtime based in the content of a folder which has the style files. But now I want to display the name of the vcl style instead of filename just like this image
How I can get the name of the style of an vcl style file?
You can use the TStyleManager.IsValidStyle
function, passing a TStyleInfo
record which return this and another info related to the vcl style.
Check this sample app
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Vcl.Styles,
Vcl.Themes;
var
Style : TStyleInfo;
begin
try
if TStyleManager.IsValidStyle('C:\Users\Public\Documents\RAD Studio\9.0\Styles\RubyGraphite.vsf', Style) then
begin
Writeln(Format('Name %s',[Style.Name]));
Writeln(Format('Author %s',[Style.Author]));
Writeln(Format('Author EMail %s',[Style.AuthorEMail]));
Writeln(Format('Author URL %s',[Style.AuthorURL]));
Writeln(Format('Version %s',[Style.Version]));
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
readln;
end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With