WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetIcon

Sets the icon displayed a by widget, currently only supported by WS_BUTTON.

Ole declaration

VARIANT_BOOL SetIconByName(LPCTSTR sObjectName, SHORT usIconId);

VARIANT_BOOL SetIconById(SHORT usObjectId, SHORT usIconId);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usIconId
Specifies the id of an icon previously loaded with WStFactory::LoadExternalIcon.
Return Value

SetIcon returns TRUE on success, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

SetIcon always loads the 32x32 pixel version of the selected icon.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short sButtonId = 4, sIconId = 33;
oFactory .CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, sButtonId, "", 0,0, 50, 50, "");
oFactory.LoadExternalIcon(sIconId, WS_EXIT, @"\IconLib.dll");
oWidget.SetIconById(iButtonId, sFontId);
Visual Basic 6 (Full Example: ButtonDemoModule.bas.txt)
Public wsWidget As New WStWidget
Public wsFactory As New WStFactory
..
wsFactory.LoadExternalIcon 7, WS_EXIT, "iconlib.dll"
wsWidget.SetIconByName "exitButton"
...
See also

EnableSubmitMode | EnableFlatStyle | ShowBorder | WStFactory::LoadExternalIcon

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