Skip to content

Class: cImageList

Properties | Events | Methods | Index of Classes

A collection of images of the same size, each of which can be referred to by its index

Hierarchy

cObject > cImageList

Show full hierarchy and direct subclasses

Library: Common Class Library

Package: cImageList.pkg

Description

This class is obsolete. It has been replaced by the cImageList32 class, which also supports icons, cursors and bitmaps with a rich-color depth.

The cImageList class only supports 16-color bitmap images.

An imagelist is a collection of images of the same size, each of which can be referred to by its index. Imagelists are used to efficiently manage large sets of images, which can then be shared by multiple objects requiring images to be displayed.

A single imagelist object can provide images to the TreeView, cToolbar and TabDialog classes.

A transparent color can be set for each image added into the imagelist. This allows the same image to be used seamlessly in a TreeView with a white background and a TabPage with a gray background.

You add images during the OnCreate event. Two functions are provided to add images: AddTransparentImage, to add transparent images, and AddImage to add non-transparent images. You need to declare how many images will be in the imagelist. You do this with the piMaxImages property. You also need to set the width and height of each image, and you do this with the piImageWidth and piImageHeight properties. When you add an image into the imagelist, the number of images actually added will be automatically inferred by dividing the width of the image you add by the size of the piImageWidth property.

Example

The following sample creates an imagelist with three images, with the default size of 16 by 16 pixels.

Object oImages is a cImageList
    Set piMaxImages To 5
    Procedure OnCreate
        Get AddTransparentImage "Cut.bmp" clFuchsia To giCutIndex
        Get AddTransparentImage "Copy.bmp" clFuchsia To giCopyIndex
        Get AddTransparentImage "Paste.bmp" clFuchsia To giPasteIndex
    End_Procedure
End_Object

Note that the index of each image is stored in a global variable that is not declared in this sample. The returned indexes could be used in the TreeView or TabDialog, etc.