Skip to content

Class: cImageList32

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 > cImageList32

Show full hierarchy and direct subclasses

Library: Common Class Library

Package: cImageList32.pkg

Description

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

An image list can contain a mixture of bitmap, icon or cursor images. The cImageList32 class supports 32-bit color depth images.

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

You add images during the OnCreate event.

The generic AddImage function is used to add a bitmap, icon or cursor to the image list. The file type is determined by the passed image file's extension (.bmp, .ico, .cur). For bitmaps the top left pixel is used to identify the transparent color.

The AddBitmap function can be used to explicitly add a bitmap to the image list. Use this function if you need to specify the bitmap's transparent color instead of using the color of the top left pixel.

The AddIcon and AddCursor functions can be used to explicitly add an icon or cursor to the image list.

Semi-transparent pixels in alpha-blend icons are rendered as black pixels.

The piImageWidth and piImageHeight properties determine the width and height of images in the image list. 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.

The piMaxImages property declares how many images will be in the imagelist.

Example

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

Object oImages is a cImageList32
    Set piMaxImages To 5
    Procedure OnCreate
        Get AddImage  "Cut.bmp"  To giCutIndex
        Get AddImage  "Copy.ico" To giCopyIndex
        Get AddBitmap "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.