SetPictureFromMemory method
Remarks
Changes at runtime one of the button pictures loading its data from a picture stored in memory in BMP format.
Syntax
Visual Basic
control.SetPictureFromMemory (index as enumPictures, pDataInMemory as string, datasize as long) as integer
Visual C++
BOOL control.SetPictureFromMemory (long index, VARIANT pDataInMemory, long datasize);
|
Parameter
|
Description
|
|
|
|
|
index
|
Numerical value that represents the index of the picture property to change. Supported values are the following:
|
Mnemonic constant
|
Value
|
Meaning
|
|
PICTURE_NORMAL
|
0
|
|
|
PICTURE_PRESSED
|
1
|
|
|
PICTURE_MOUSEOVER
|
2
|
|
|
PICTURE_CUSTOM
|
3
|
|
|
PICTURE_TEXTURE
|
4
|
|
|
PICTURE_DISABLED
|
5
|
|
|
|
pDataInMemory
|
Variant parameter containing the pointer to picture data previously loaded in memory.
|
|
datasize
|
Numerical value that represents the data size in bytes.
|
Visual Basic example
Dim bitspict As String
Dim length As Integer
bitspict = LoadResData(xxx, 2)
length = LenB(bitspict)
BtnEnh1.SetPictureFromMemory PICTURE_NORMAL, bitspict, length
With this code the
Picture property will be changed using a bitmap identified by xxx (contained in a .RES file).
Visual C++ example
VARIANT va;
VariantInit (&va);
va.vt = VT_BYREF | VT_UI1;
va.pbVal = (BYTE *) pointer_to_bitmap_in_memory;
BtnEnh1.SetPictureFromMemory (PICTURE_NORMAL, va, size_of_data);
With this code the
Picture property will be changed using a bitmap previously loaded in memory.
Return value
|
Value
|
Meaning
|
|
|
|
|
FALSE
|
The operation failed
|
|
TRUE
|
The operation was successful
|