WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetBackGroundColor

Sets the background color for a specific widget.

Ole declaration

VARIANT_BOOL SetBackgroundColorByName(LPCTSTR sObjectName, SHORT usRed, SHORT usGreen, SHORT usBlue);

VARIANT_BOOL SetBackGroundColorById(SHORT usObjectId, SHORT usRed, SHORT usGreen, SHORT usBlue);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usRed
Specifies the intensity of the red color.
usGreen
Specifies the intensity of the green color.
usBlue
Specifies the intensity of the blue color.
Return Value

On success, SetBackGroundColor returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

The red, green and blue colors must be in the range 0-255, if the colors are not in this range each value will be truncated.

When used on a WS_MENU (which type is WS_BUTTON_MENU_TYPE), the background color of the buttons is modified, not the menu's background color. To change the menu's background color call WStForm::SetBackgroundColor instead

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iFieldId = 33;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_FIELD, iFieldId, "", 0,0, 50, 50, "123");
wsWidget.SetBackGroundColorById(iFieldId, 206, 219, 247);
Visual Basic 6 (Full Example: ButtonDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
'Button Test 2: White background, blue font
wsWidget.SetTextColorByName "buttonTest2", 0, 0, 160
wsWidget.SetBackGroundColorByName "buttonTest2", 255, 255, 255
wsWidget.SetIconByName "buttonTest2", 2
...
	
See also

SetTextColor | SetBarColor | SetText | GetText | WStForm::SetBackgroundColor

WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference