Visual Basic Reference
LoadResPicture Function
See Also Example Applies To
Loads a bitmap, icon, or cursor from a resource (.res) file.
Syntax
LoadResPicture(index, format)
The LoadResPicture function syntax has these parts:
Part | Description |
index | Required. Integer or string specifying the identifier (ID) of the data in the resource file. The resource whose ID is 1 is reserved for the application icon. |
format | Required. Value or constant that specifies the format of the data being returned, as described in Settings. |
Settings
The settings for format are:
Constant | Value | Description |
vbResBitmap | 0 | Bitmap resource |
vbResIcon | 1 | Icon resource |
vbResCursor | 2 | Cursor resource |
Remarks
You can use the LoadResPicture function instead of referring to graphics stored in the Picture property of a Form or controls.
Storing bitmaps, icons, or cursors in and accessing them from resource files improves load time because you can load them individually as needed from the resource file, rather than all at once when a Form is loaded.
Using LoadResPicture is useful for localizing a Visual Basic application because the resources that need to be translated are isolated in one resource file and there is no need to access the source code or recompile the application.