NewImageList

Description

Adds an imagelist to a form

An ImageList control contains a collection of ListImage objects, each of which can be referred to by its index or key. The ImageList control is not meant to be used alone, but as a central repository to conveniently supply other controls (for instance listviews) with images

Syntax

[Set oCtl =] oFrm.NewImageList

( Name, ImageWidth, ImageHeight )

Parameters

Part

Description

Set oCtl =

(optional) Store a reference to the new control in the variable oCtl. This variable can be used to access the control's properties and methods

oFrm

A reference to a form object (see the NewForm method)

Name

The name of the control. It must be unique within the form and may not be empty or start with an asterisk (*)

ImageWidth

See the list of properties below

ImageHeight

See the list of properties below

Properties and Methods

Property

Description

BackColor

The background color (use the RGB function to assign a color value)

ImageHeight

The height of ListImage objects in the ImageList, measured in pixels.

Before any ListImage objects have been added to the control, you can set both ImageHeight and ImageWidth. However, once a ListImage object has been added, these properties cannot be changed.

Important When the ImageList control is bound to another Windows Common Control, all images in the ListImages collection - no matter what their size - will be displayed in the second (bound control) at the size specified by the ImageHeight and ImageWidth properties.

Note You can the use the ImageList control with any control by setting the Picture property of the second control to the Picture object of any image contained by the ImageList control. However, the size of the displayed image will not be affected by the ImageHeight and ImageWidth properties. In other words, the second control will display the image at its original size.

ImageWidth

The height of ListImage objects in the ImageList, measured in pixels.
Also see the remarks for ImageHeight above

ListImages

A reference to a collection of ListImage objects.

You can manipulate ListImages using standard collection methods (for example, the Add and Clear methods). Each member of the collection can be accessed by its index or unique key, which are stored in the Index and Key properties, respectively, when a ListImage is added to a collection.

MaskColor

The color used to create masks (use the RGB function to specify a color).

Every image in a ListImages collection has a corresponding mask associated with it. The mask is a monochrome image derived from the image itself, automatically generated using the MaskColor property as the specific color of the mask. This mask is not used directly, but is applied to the original bitmap in graphical operations such as the Overlay and Draw methods. For example, the MaskColor property determines which color of an image will be transparent in the Overlay method.

If the system colors change, then the color which is transparent will change, making the look of your picture unpredictable. It is good programming practice to use non-system colors
.

Tag

(reserved) Used internally to store the user-defined controlname

UseMask

(boolean) Determines whether the MaskColor will be used as a mask

Method

Description

Overlay

Parameters: Index1, Index2

Draws one ListImage over another, and returns the result

Index1

An integer (Index property) or unique string (Key property) that specifies the image to be overlaid

Index2

An integer (Index property) or unique string (Key property) that specifies the image to be drawn over the object specified in Index1. The color of the image that matches the MaskColor property is made transparent. If no color matches, the image is drawn opaquely over the other image.

Use the Overlay method in conjunction with the MaskColor property to create a single image from two disparate images. The Overlay method imposes one bitmap over another to create a third, composite image. The MaskColor determines which color of the overlaying image is transparent

Example

See the NewListView page for an example of using an ImageList with a ListView control