Applies to

All controls.

Description

Returns or sets the foreground color of the specified control.

Usage

foregroundcolor = Get_Property (objectname"FORECOLOR")

existingprop = Set_Property (objectname"FORECOLOR"color)

Remarks

Values passed in Set_Property:

ValueDescription
ColorNew color value.

The intensity for each argument can range from 0 through 255. If all three intensities are set to zero, the result is black. If all three intensities are set at 255, the result is white.

For BASIC+, the formula for color value is:

color = red + (green * 256) + (blue * 65536)

For child window control, FORECOLOR 0 sets the background color to the default. To make the child window foreground black, pass color = 1

Returns

Values returned by both Get_Property and Set_Property:
ValueDescription
foregroundcolorForeground color value of specified control.
existingpropForeground color value, when Set_Property was called. That is, the value before it was changed.

See also

BACKCOLOR propertyGRADIENTSTYLE propertyCHOOSECOLOR Utility() serviceRGB function

Example

Example 1: sets the color for CtrlEntID

Color  = Get_Property(CtrlEntID, "FORECOLOR")
Parent = CtrlEntID [1,"."]
Color  = Utility("CHOOSECOLOR", Parent, Color)
if len(Color) then
  Set_Property(CtrlEntID, "FORECOLOR", Color)
end

Example 2

Example 2: convert between an @vm-delimited RGB value (used by QuickHelp and Msg, for example) and a Color value (the FORECOLOR and BACKCOLOR property values)

* convert from RGB to Color
Color = RGB<1,1> + RGB<1,2> * 256 + RGB<1,3> * 65536
* convert from Color to RGB
RGB   = ""
Temp  = Color        ;* don't modify the Color value
for i = 1 to 3
  RGB<1,i> = mod(Temp, 256)
  Temp     = int(Temp / 256)
next I
  • No labels