AddPicture PowerScript function
Description
Adds a bitmap, icon, or cursor to the main image list.
Controls
PictureListBox, DropDownPictureListBox, and TreeView controls
Syntax
|
1 |
<span>controlname</span>.<span>AddPicture</span> ( <span>picturename</span> ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the control to which you |
|
picturename |
The name of the icon, cursor, or bitmap |
Return Values
Integer. Returns the picture index number
if it succeeds and -1 if an error occurs.
Usage
The picture is assigned an index in the order in which it
is added to the control.
Adding pictures at runtime does not update the PictureName
property array. Because the picture is added at the end of the list,
the return value from AddPicture is the number
of pictures associated with the control.
Before you add pictures, you can specify scaling for the pictures
by setting the PictureWidth and PictureHeight properties. The dimensions
in effect when you add the first picture determine the scaling for
all pictures. Changing the property values after you add pictures
has no effect.
If you do not specify values for PictureWidth and PictureHeight
before you add pictures, the dimensions of the first image determine
the scaling for all pictures you add.
When a you add a bitmap, specify the color in the bitmap that
will be transparent by setting the PictureMaskColor property before
calling AddPicture. You can change the PictureMaskColor property
between calls.
Examples
This example adds a picture to a TreeView control
and associates it with a new TreeView item:
|
1 |
long ll_tvi |
|
1 |
integer li_picture |
|
1 |
li_picture = & |
|
1 |
tv_list.<span>AddPicture</span>("c:apps_pbstaff.ico") |
|
1 |
ll_tvi = tv_list.FindItem(RootTreeItem!, 0) |
|
1 |
tv_list.InsertItemFirst(ll_tvi, "Dept.", li_picture) |