SetOverlayPicture
PowerScript function
Description
Puts an image in the control’s image list into an overlay image
list.
Applies to
ListView and TreeView controls
Syntax
|
1 |
controlname.SetOverlayPicture ( overlayindex, imageindex ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the ListView or TreeView control to which you |
|
overlayindex |
The index number of the overlay picture in the overlay |
|
imageindex |
The index number of an image in the control’s main image |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs.
Usage
An overlay picture must have the same height and width as the
picture it is used to overlay. The color specified in the SetPictureMask
property when the picture is inserted becomes transparent when the picture
is used as an overlay, allowing part of the original image to be visible
beneath the overlay.
The overlay list acts as a pointer back to the source image in the
regular picture lists. If you delete an image that is also used in the
overlay list, the displayed overlay pictures are affected too.
Examples
This example designates overlay images in a ListView control. The
same picture is used for large and small images:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Set up the overlay images integer index index = lv_1.AddLargePicture("shortcut.ico") index = lv_1.AddSmallPicture("shortcut.ico") lv_1.SetOverlayPicture(1, index) index = lv_1.AddLargePicture("not.ico") index = lv_1.AddSmallPicture("not.ico") lv_1.SetOverlayPicture(2, index) // Assign the second overlay image to the first item listviewitem lvi integer i i = lv_1.GetItem(1, lvi) lvi.OverlayPictureIndex = 2 i = lv_1.SetItem(1, lvi) |
This example designates the first picture in the TreeView’s main
image list as the first overlay picture. The picture was added to the main
image list on the TreeView’s property sheet:
|
1 |
tv_list.SetOverlayPicture(1, 1) |
This code in the TreeView’s Clicked event assigns the overlay image
to the clicked item:
|
1 2 3 4 |
treeviewitem tvi tv_list.GetItem(handle, tvi) tvi.OverlayPictureIndex = 1 tv_list.SetItem(handle, tvi) |