FMX.Styles.TStyleManager.SetStyle
Delphi
class procedure SetStyle(const Style: TFmxObject); overload;
class procedure SetStyle(const Context: TFmxObject; const Style: TFmxObject); overload;
C++
__classmethod void __fastcall SetStyle(Fmx::Types::TFmxObject* const Style)/* overload */;
__classmethod void __fastcall SetStyle(Fmx::Types::TFmxObject* const Context, Fmx::Types::TFmxObject* const Style)/* overload */;
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FMX.Styles.pas FMX.Styles.hpp |
FMX.Styles | TStyleManager |
Description
Sets the active style to the instance specified by the Style
parameter.
To set the active style to the native system style, for example Windows theme, pass nil
as the Style
parameter.
- Note: If you call the SetStyle function in the initialization section of a unit on the main project file, before
Application.Initialize
, then it is applied to all forms.
Example
This Delphi code demonstrates how to use the StyleManager:
Delphi:
procedure TForm1.FormCreate(Sender: TObject);
var
od : TOpenDialog;
begin
od := nil;
try
od := TOpenDialog.Create(self);
od.Filter := 'Style Files|*.style';
if od.Execute() then
TStyleManager.SetStyleFromFile(od.FileName);
finally
od.Free();
end;
end;