WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetTextColor

This method changes the color of the text displayed by a widget.

Ole declaration

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

VARIANT_BOOL SetTextColorById(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, SetTextColor 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.

If this method is applied to a WS_LINE widget, the color of the line will be changed.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iLineId = 66;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_LINE, iLineId , "", 0,0, 50, 50, "");
oWidget.SetTextColor(iLineId, 255, 0, 128);	
Visual Basic 6 (Full Example: BasicPropertiesDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
'Changes the color of both top and bottom lines
wsWidget.SetTextColorByName "topLine", 229, 229, 229
wsWidget.SetTextColorByName "bottomLine", 229, 229, 229
...
See also

SetBackgroundColor | SetBarColor | SetText | GetText

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