SetOverlayPicture PowerScript function
Description
Puts an image in the control’s image list into an
overlay image list.
Controls
ListView and TreeView controls
Syntax
|
1 |
<span>controlname</span><span>.SetOverlayPicture</span> ( <span>overlayindex, imageindex</span> ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the ListView or TreeView |
|
overlayindex |
The index number of the overlay picture |
|
imageindex |
The index number of an image in the control’s |
Return Values
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 |
// Set up the overlay images |
|
1 |
integer index |
|
1 |
index = lv_1.AddLargePicture("shortcut.ico") |
|
1 |
index = lv_1.AddSmallPicture("shortcut.ico") |
|
1 |
lv_1.<span>SetOverlayPicture</span>(1, index) |
|
1 |
index = lv_1.AddLargePicture("not.ico") |
|
1 |
index = lv_1.AddSmallPicture("not.ico") |
|
1 |
lv_1.<span>SetOverlayPicture</span>(2, index) |
|
1 |
// Assign the second overlay image to the first item |
|
1 |
listviewitem lvi |
|
1 |
integer i |
|
1 |
i = lv_1.GetItem(1, lvi) |
|
1 |
lvi.OverlayPictureIndex = 2 |
|
1 |
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.<span>SetOverlayPicture</span>(1, 1) |
This code in the TreeView’s Clicked event
assigns the overlay image to the clicked item:
|
1 |
treeviewitem tvi |
|
1 |
tv_list.GetItem(handle, tvi) |
|
1 |
tvi.OverlayPictureIndex = 1 |
|
1 |
tv_list.SetItem(handle, tvi) |