From RAD Studio API Documentation
Jump to: navigation, search



TStyleBook = class(TFmxObject)


class PASCALIMPLEMENTATION TStyleBook : public Fmx::Types::TFmxObject


Type Visibility Source Unit Parent
class public
FMX.Controls FMX.Controls


TStyleBook stores a collection of styles for a form.

There are two ways to create and use a TStyleBook component:

  • Drop a TStyleBook component from the Tool Palette onto the Form Designer and make your new TStyleBook component the value of the StyleBook property of the form. This works for desktop applications and mobile applications.
  • Right-click a control on a FireMonkey desktop form and choose either Edit Default Style or Edit Custom Style. This automatically creates a TStyleBook component, sets it to the form's StyleBook, and opens the Style Designer.

TStyleBook stores the style definition as text in the Resource property and can be loaded from a .style file. Double-clicking the TStyleBook component on the form opens the Style Designer.

TStyleBook and Form Inheritance

  • If you want all the descendant forms to have the same style as the base form, place the TStyleBook in the base form.
  • If you want the descendant forms to have different styles, place separate TStyleBooks in the descendant forms.
Note: At design time, using the StyleLookup property of a control in any form in the current project group you can access any custom style defined in any TStyleBook component used in the current project group. That is, even if the form does not have a particular TStyleBook component, controls from this form can use custom styles defined in this TStyleBook component (if this TStyleBook component is used in any form in the current project group). At run time, only styles in the current project and only after an owner of the TStyleBook containing these styles is already created can be accessed.

See Also