Applies to

All controls.

Description

Sets or retrieves the RGB value associated with the background color of the specified control.

Usage

backgroundcolor = Get_Property (objectname, " BACKCOLOR ")

existingprop = Set_Property (objectname, " BACKCOLOR ", 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)

BACKCOLOR for a window can be set only if it does not have 3-D style.

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

Returns

Values returned by both Get_Property() and Set_Property():

ValueDescription
backgroundcolorExisting color value.

See also

FORECOLOR propertyGRADIENTSTYLE propertyCHOOSECOLOR Utility() service

Example

* Example 1:  sets the color for CtrlEntID
Color  = Get_Property(CtrlEntID, "BACKCOLOR")
Parent = CtrlEntID [1,"."]
Color  = Utility("CHOOSECOLOR", Parent, Color)
if len(Color) then
  Set_Property(CtrlEntID, "BACKCOLOR", Color)
end
/* 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