WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetImageFile

This method changes the image displayed on a WS_BITMAP  widget.

Ole declaration

VARIANT_BOOL SetImageFileByName(LPCTSTR sObjectName, LPCTSTR sFileName);

VARIANT_BOOL SetImageFileById(SHORT usObjectId, LPCTSTR sFileName);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
sFileName
The location of image on the mobile unit e.g.: \Windows\Car.jpeg
Return Value

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

Remarks

The supported formats are BMP, JPEG and PNG.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
RFFile oRfFile = new RFFile();
WStFactory oFactory = new WStFactory();
short iBitmapId = 22;
oFactory .CreateWidgetById((short)WSTFactoryConstants.WS_BITMAP, iBitmapId, "", 0,0, 50, 50, "");

/* If the bmp is not found, it must be downloaded */
if (oRfFile.RFListFiles("stockUtilLogo.bmp") == 0) {
	oRfFile.RFTransferFile(@"../SamplesWidgets\Exe\Resources\Car.bmp",
	@"\Test\Resources\car.bmp", true);
}
oWidget.SetImageFileById(iBitmapId , @"\Test\Resources\car.bmp");
Visual Basic 6 (Full Example: BitmapDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
Select Case wsForm.GetLastEventSourceName()
	'If any function key is pressed or the exit button is pressed
	'the loop is ended
	Case "exitButton"
		bEnd = True
	Case "WSFunctionKeysController"
		bEnd = True
	Case "Image1Btn"
		wsWidget.SetImageFileByName "Image", "information.bmp"
	Case "Image2Btn"
		wsWidget.SetImageFileByName "Image", "shield.bmp"
	Case "Image3Btn"
		wsWidget.SetImageFileByName "Image", "warning.bmp"
	End Select
...
See also

RFFile object

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