Vcl.ImageCollection.TImageCollection

From RAD Studio API Documentation
Jump to: navigation, search

Vcl.BaseImageCollection.TCustomImageCollectionSystem.Classes.TComponentSystem.Classes.TPersistentSystem.TObjectTImageCollection

Delphi

TImageCollection = class(TCustomImageCollection)

C++

class PASCALIMPLEMENTATION TImageCollection : public Vcl::Baseimagecollection::TCustomImageCollection

Properties

Type Visibility Source Unit Parent
class public
Vcl.ImageCollection.pas
Vcl.ImageCollection.hpp
Vcl.ImageCollection Vcl.ImageCollection

Description

TImageCollection component stores, scales, and draws images.

The component allows you use images with native formats using the TWICImage class.

Use TImageCollection in combination with TVirtualImageList component as the source for images. Go to Supporting high-DPI images with the Image Collection and Virtual ImageList components for the instructions on how to use these two components.

TImageCollection is inherited from TCustomImageCollection class, which defines the base methods for a collection.

Using TImageCollection within a DLL

TImageCollection uses the Windows Imaging Component (WIC), a COM-based framework. COM is always initialized by a VCL application. However, if the component is used from within a DLL and that DLL is used by your application, it will load before the host application's startup code runs, i.e. before COM has been initialized. This results in 'Runtime error 217.'

To resolve this:

  • Load the DLL explicitly using LoadLibrary and GetProcAddress.
    • If the host app is not a VCL application, call CoInitialize before calling LoadLibrary.
  • Mark the DLL's exported function as 'delayed', thus loading the DLL the first time the function is called, by then the VCL app (and COM) will have already been initialized.

This can affect other inbuilt components that use the image collection, such as TDBNavigator.

See Also