Partager via


Themes Property

Specifies whether Windows XP Themes are enabled or disabled for a control. For forms and toolbars, Themes controls whether child objects are themed. Read/write at design and run time.

Note

The Themes property for visual classes can affect your existing user interface when using Microsoft Windows XP. You can turn this support off by setting the Themes property at the control, form, or _SCREEN system variable level.

Object.Themes [ = lExpr ]

Parameters

  • lExpr
    Logical data type. The following table lists the settings for lExpr.

    lExpr  

    True (.T.)

    Enabled (Default)

    False (.F.)

    Disabled

Remarks

Applies To: _SCREEN System Variable | CheckBox Control | ComboBox Control | CommandButton Control | CommandGroup Control | Form Object | Grid Control | Image Control | ListBox Control | OptionButton Control | OptionGroup Control | PageFrame Control | Spinner Control | TextBox Control | ToolBar Object

Controls defined using @...GET or @...SAY and similar @... commands are not compatible with Windows XP Themes. Therefore, when running programs written with FoxPro 2.x on Windows XP or later, you should set the _SCREEN.Themes property to False (.F.); otherwise, the controls on the forms disappear. The following example illustrates code that you can use to prevent the controls on the forms from disappearing:

_SCREEN.Themes = .T.

DEFINE WINDOW ThemesDemo AT 0.000, 0.000;
   SIZE 29.000,121.200;
   TITLE "ThemesDemo";
   FONT "MS Sans Serif", 8;
   float;
   CLOSE;
   NOMINIMIZE;
   SYSTEM;
   COLOR RGB(,,,192,192,192)

ACTIVATE WINDOW ThemesDemo

@ 2.500,55.833 GET DemoDB;
   PICTURE "@*C Demo CheckBox";
   SIZE 1.308,21.400;
   DEFAULT 0;
   FONT "Microsoft Sans Serif", 8;
   STYLE "T"
   _SCREEN.activeform.lockscreen = .T.
   _SCREEN.activeform.lockscreen = .F.
READ CYCLE

You can set _SCREEN.Themes property to False (.F.) to disable Themes entirely in Visual FoxPro.

Note

When you set _SCREEN.Themes property, you do not actually alter the current state of Themes set at the operating system level. You should use SYS(2700) - Enables Windows XP Themes to check the current state of Themes.

When Themes is enabled, Visual FoxPro overrides the SpecialEffect property and uses the default theme except when SpecialEffect is set to a value of 2 (hot tracking). In this scenario, Visual FoxPro preserves hot tracking, which displays special effects when you move the mouse over the CommandButton, graphical OptionButton and CheckBox controls.

For CheckBox controls, Themes supports three-state check boxes.

For Form and ToolBar objects, Themes enables themes for the entire form. To enable themes for a control, you need to set Themes to True (.T.) for both the form and control. For other container controls such as PageFrame, Themes does not control how child objects display themes; it controls only visual aspects such as borders or tabs.

Note

When Themes are enabled, you should avoid using the CLEAR command for forms because it might cause paint issues with themed controls, such as command buttons, that have mouse hovering effects.

For OptionGroup, CommandGroup, and Image controls, Themes determines whether borders are themed.

Controls such as PageFrame tabs and Grid headers are dynamically drawn by the operating system Themes manager when you move your mouse over them. Therefore, do not position other controls on top of these controls.

For a Grid control, Themes affects the visual appearance of column headers. If themes are enabled for a grid, the BackColor and ForeColor properties of the header are disregarded because they inherit the attributes of the theme. However, the BackColor and ForeColor properties of a Column object display independently from the setting of a grid's Themes property.

For PageFrame controls, Themes determines whether tabs are themed. You might need to make minor modifications to forms that contain PageFrame objects. The Themes property provides a gradient effect on Page objects, so a label, option button, or similar control with text does not appear correctly if the BackStyle property of the control is set to Opaque. You can remedy this situation by setting BackStyle to Transparent.

If your operating system does not support themes, or if Themes is turned off, Visual FoxPro uses the settings controlled by SpecialEffect and other properties.

For more specific details about Windows XP Themes, see the following resources:

See Also

Reference

SpecialEffect Property
Style Property
SYS(2700) - Enables Windows XP Themes

Other Resources

Properties (Visual FoxPro)