VCL Styles Overview

From RAD Studio
Jump to: navigation, search

Go Up to Developing Applications with VCL Components

What Is a Style

You can change the appearance of a VCL application by using a style. A style is:

  • A set of graphical details that define the look and feel of a VCL application.
  • Similar to a theme in Windows.

A style permits you to change the appearance of every part and state of a control. VCL controls are made up of parts and states. A VCL style consists of a set of values for each of these parts and states. For instance, a scroll bar has the following parts: frame, slider, and the two side buttons for each direction. The side buttons, for example, have the following states: pressed, disabled, hot, normal.

To set a style for your VCL application, select the style in Project Options > Application > Appearance. See Application Appearance for more details.

Location of Style Files (.vsf Files):

  • The VCL styles that ship with the product are available in:
    C:\Users\Public\Public Documents\RAD Studio\<n.n>\Styles.
  • In addition, you can redistribute any of the styles (VCL or FireMonkey) with your applications. The redistributable style files are located in your product installation directory at:

Bitmap Style Designer

You can create your own styles or modify the existing ones by using the Bitmap Style Designer, available in the Tools menu. For more details, see Creating a Style using the Bitmap Style Designer.

The Bitmap Style Designer also supports conversion of a VCL style to a FireMonkey style, and provides test applications to test VCL styles, FireMonkey styles, and FireMonkey Metro Styles.

Managing a Style

You can use the Vcl.Themes.StyleServices function to programmatically access information about the current style. Using StyleServices you can obtain information about the styled controls and elements and can perform drawing of controls. See Vcl.Themes.TCustomStyleServices for a better understanding of the Vcl.Themes.StyleServices interface.

Use the Vcl.Themes.TStyleEngine class to register style hook classes for your custom VCL components. A style hook is a class that you must implement to provide custom message handling for your custom control. If you have a custom control that needs special visual processing, create a style hook class that processes messages by inheriting from Vcl.Themes.TStyleHook.

Use the Vcl.Themes.TStyleManager class to load, register, and select styles or to get, register, and unregister a style engine.

See Also