ForeColor Property

Gets or sets the foreground (text) color of the control.

object.ForeColor = [color]

Where object is an object expression that evaluates to one of the controls in the Applies To list, and color is a value or constant that determines the background color of an object, as described in Settings.

Client support

   Newlook Smartclient

   Newlook Server

Skin limitations

None. Supported in both Material and Classic skin.

Enabling the material skin has no impact on the ForeColor property. The default property for ForeColor will still be derived from the active scheme in Color Settings, and any changes to this property, in Designer or dynamically at run-time, will be respected.

Use

The ForeColor property determines the color of the control's text. In the case of the tab page object, this property determines the color of the tab page button text.

For the Command button, Label, Menu button and Tab page object, the ForeColor property determines the unselected color of any text in the control or object. The HoverColor property is used to set the color of text when the user hovers over the object. The tab page object has an additional property, SelectedForeColor, which is used to set the color of tab button text when the tab is selected.

Settings

The settings for color can be specified in one of the following ways:

Setting

Description

JScript Example

Hexadecimal colors

A hexadecimal value for Color can be specified by using the either the Themed or Custom color palette (see notes below) or by specifying the hexadecimal value of the color in the following format:

&H00BBGGRR (where BB = the blue hex value, GG = the green hex value and RR = the red hex value) .

App.Activeform.MyLabel.BackColor = "&H000066FF";

Named colors

Colors specified in the Named tab of the Color palette (see notes below).

App.Activeform.MyLabel.BackColor = "Tomato";

Constant

One of the Newlook color constants. Refer to Color Constants for a full list.

App.Activeform.MyLabel.BackColor = nlClrBlue;

Color Palettes

There are four different color palettes available in Design:

Themed Color Palette

Allows the user to select a color from a series of themed color palettes.

Named Color Palette

Allows the user to select a color from the basic and extended .NET color keywords.

Custom Color Palette

Allows the user to enter specific RGB values, Hex value or select a color from a broader color palette.

Material Color Palette

Allows the user to select a color which is a shade of the current material skin's primary and secondary colors.

Converting color values in scripts and macros

It is possible to specify color values in either the hexadecimal-based &H00BBGGRR format or as a decimal value when setting color-based properties dynamically in a script or macro.

It is important to note though, that macros return colors in the hexadecimal format whereas scripts return colors as a decimal value.

Occasionally you may need to convert from the decimal format to the hexadecimal-based format in order to compare values within a script. To do this you can use the following code in your script:

VB SCRIPT

vHexColor = "&H00" & Hex(App.ActiveForm.BackColor)

JAVASCRIPT

vHexColor =  "&H00" + App.ActiveForm.BackColor.toString(16);

See Also

BackStyle property | Color constants | MaskColor property | SelectedForeColor property| HoverColor property | DataForeColor property | DataAltForeColor property

Applies To

Check box control

Combo box control

Command button control

Data control

Date combo box control

Frame control

Label control

List box control

ListView control

ListViewItem object

Menu button control

NumericCombo control

Option button control

TabPage object

Text box control

TreeView control

TreeView Node object


© 2004-2021 looksoftware. All rights reserved.