Applying Painting Styles
- 3 minutes to read
Tab controls support various painting styles. There are eleven predefined styles provided by both the TcxPageControl and TcxTabControl controls. This topic describes how you can apply these predefined painting styles to controls. It also contains information regarding what can and what cannot be implemented when a certain style is applied.
Applying Painting Styles
Two properties can be used at design time to specify the painting style applied to a control. These are the LookAndFeel and Properties.Style properties. The LookAndFeel property returns an object that has four properties affecting the look & feel of the control: AssignedValues, Kind, NativeStyle, and SkinName.
The AssignedValues property specifies whether the Kind, NativeStyle, and SkinName properties are available. Its value is a set that can include lfvKind, lfvNativeStyle, and lfvSkinName. If an empty set is assigned to this property, the painting style applied to the control specified by the Properties.Style property.
The Properties.Style property value can be changed by the SetStyleByStyleName or SetStandardStyle method call. The table below lists the correlation between the Properties.Style property values and parameters of these methods.
Style property values | SetStyleByStyleName method parameters | SetStandardStyle method parameters | Description |
---|---|---|---|
0 | ‘Default’ | - | Applies the Flat painting style to the control. |
1 | ‘Tabs’ | tsTabs | Applies the Tabs painting style to the control. |
2 | ‘Buttons’ | tsButtons | Applies the Buttons painting style to the control. |
3 | ‘FlatButtons’ | tsFlatButtons | Applies the Flat Buttons painting style to the control. |
5 | ‘ExtraFlat’ | - | Applies the Extra Flat painting style to the control. |
6 | ‘UltraFlat’ | - | Applies the Ultra Flat painting style to the control. |
7 | ‘Flat’ | - | Applies the Flat painting style to the control. |
8 | ‘Office11’ | - | Applies the Office11 painting style to the control. |
9 | ‘Slanted’ | - | Applies the Slanted painting style to the control. |
10 | ‘OneNote’ | - | Applies the OneNote painting style to the control. |
11 | ‘Skin’ | - | Applies the Skin painting style to the control. |
For instance, the following code lines are equivalent:
cxTabControl1.Style := 2;
cxTabControl1.SetStandardStyle(tsButtons);
cxTabControl1.SetStyleByStyleName('Buttons');
The Kind property of the look & feel object has influence on the control’s style only if the Style property is 0 (‘Default’) and the lfvKind value is contained in the AssignedValues property. The table below lists painting styles corresponding to the Kind property values in such an instance.
property’s values | Description |
---|---|
lfStandard | Applies the Tabs painting style to the control. |
lfFlat | Applies the Flat Buttons painting style to the control. |
lfUltraFlat | Applies the Ultra Flat painting style to the control. |
lfOffice11 | Applies the Office11 painting style to the control. |
The NativeStyle property value is also in effect only when the Default style is applied by the Properties.Style property and the lfvNativeStyle value is contained in the AssignedValues property. The NativeStyle property overrides all other settings in this instance. It applies the XP painting style to the control if the end-user’s operating system is Windows XP or later. Otherwise, the Tabs painting style is applied.
Style Features
The selecting multiple tabs feature is available when the Buttons or Flat Buttons painting style is applied. To allow multiple tabs to be selected at the same time, set the MultiSelect property to True. Refer to the Handling Multiple Selections topic for details on this feature.
If tabs don’t appear as buttons, tab rows can be scrolled to opposite sides of a control. The ScrollOpposite property must be set to True to implement this feature. Refer to the Tab Position and Arrangement topic for details.