Home > Language Reference > Classes > Bitmap
CreateFromResource Method
Creates an image from a resource.
Syntax
Public Sub CreateFromResource(ByRef objStream As StreamMemory)
| Parameter | Description |
| objStream | Memory buffer from which the image will be created. |
Remarks
The CreateFromResource method creates a new image from data packed into a memory buffer accordingly to the Palm OS® resource format. If the data passed through the StreamMemory object is a bitmap family, the current graphic mode is taken into account to choose the most appropriate image. The image previously stored in the Bitmap object is destroyed.
This method is typically used to extract an image from another application resource. The example below displays in a Picture control the "Address" application icon:
Private Sub Button1_Click()
Dim db as New ResourceDB, bm as New Bitmap
db.OpenByName "Address Book", hbModeOpenExisting+hbModeReadOnly
bm.CreateFromResource db.Resource("tAIB",1000)
Set Picture1.Image = bm
db.Close
End SubThe CreateFromResource method can read any bitmap or bitmap family conforming to the Palm OS® BitmapTypeV0, BitmapTypeV1, BitmapTypeV2 and BitmapTypeV3 structures, which are defined as C structures in the SDK header files. You should refer to the relevant documentation if you need to learn more about these formats.
Note: HB++ does not check that the StreamMemory object passed as a parameter actually contains a Palm OS® bitmap or bitmap family. If this is not the case, a fatal error requiring the device to be restarted can occur.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |