WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStForm class reference

SetBackGroundColor

Call this method to change the background color of a specific form.

Ole declaration

VARIANT_BOOL SetBackGroundColorByName(LPCTSTR sFormName, SHORT usRed, SHORT usGreen, SHORT usBlue);

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

Parameters
sFormName
The form's name.
usFormId
The form's id.
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 the form's background color changes some widgets will try to change their background color to match the form new background color, the widgets that support this feature are: WS_BITMAP, WS_CHECKBOX, WS_LABEL, WS_LINE, WS_MENU (when it behaves as a button menu) and WS_RADIO_BUTTON. This feature only works if the background color is set before the form is serialized and displayed on the mobile unit.

Example
C#
using WirelessStudioOleWidgets;
WStFactory oFactory = new WStFactory();
WStForm oForm = new WStForm ();
short formId = 10;
oFactory.CreateFormById(formId);
oForm.SetBackGroundColorById(formId, 255, 0, 0);
Visual Basic 6 (Full Example: MenuDemoModule.bas.txt)
Public wsForm As New WStForm
...
Public Sub ConfigWidgetColors()
    wsForm.SetBackGroundColorByName "myForm", 255, 255, 255
    ...
End Sub
...	
See also

CommitChanges

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