LMD VCL - ImageList support

From LMD
Jump to: navigation, search

<< Back to Getting started or Product Resources page

[edit]

Introduction

Since LMD-Tools 8 LMD ImageLists are derived from TCustomImageList. Thus LMD Controls which could previously linked to LMD ImageLists can now make use of any TCustomImageList descendant. The other way around is unfortunately possible only, when no System ImageList Handle is required (e.g. Win32 controls of VCL palette will not be compatible. They can be linked to LMD ImageLists, but they can not make use of it). Other controls which use only Draw or GetBitmap methods will work, though.

LMD ImageLists are in LMD 2007 branch part of the lmdrtlx runtime package, thus also ElPack controls can make use of the advanced imagelist controls.

Wrapper methods

LMD-Tools ImageLists provide advanced functionality which is not available in VCL imagelists. Examples are two dimensional imagelists like in TLMDImageList or storing of any graphic file (in any size) in TLMDGraphicList. To allow programmers to easily access imagelists in a common way, wrapper methods were created in LMDCont unit, which take care to handle features of different imagelist classes. Available methods are:

General

<delphi>function LMDIsSingleItemImageList(aList:TCustomImageList):Boolean;</delphi> Returns false when imagelist is a list of imagelists (--> TLMDImageList and -Connector), 2 dimensional imagelists are referenced by controls via ListIndex (index of imagelist) AND ImageIndex (index of image) properties. LMD-Tools controls use the ListIndex property only, when imagelist is only one-dimensional.

<delphi>function LMDIsCollectionImageList(aList:TCustomImageList):Boolean;</delphi> Returns true when imagelist is a collection of imagelists (--> TLMDImageListConnector)

ImageList specific

<delphi>function LMDIMLIsValidItem(aList:TCustomImageList; ListIndex, ImageIndex:Integer):Boolean;</delphi> Checks whether Image is specified by ListIndex and ImageIndex is valid in ImageList aList.

<delphi>procedure LMDIMLItemBitmap(aList:TCustomImageList; ListIndex, ImageIndex:Integer; tmp:TBitmap);</delphi> Retrieve from ImageList aList the item indexed by ListIndex/ImageIndex parameters.

<delphi>function LMDIMLItemWidth(aList:TCustomImageList; ListIndex:Integer):Integer;</delphi> Returns width of a particular item.

<delphi>function LMDIMLItemHeight(aList:TCustomImageList; ListIndex:Integer):Integer;</delphi> Returns height of a particular item.

<delphi>function LMDIMLItemRect(aList:TCustomImageList; ListIndex, ImageIndex:Integer):TRect;</delphi> As before, but returns a TRect record for specified item.

<delphi>function LMDIMLPalette(aList:TCustomImageList; ListIndex:Integer):HPalette;</delphi> Returns associated palette for specified item.

<delphi>function LMDIMLCount(aList:TCustomImageList;ListIndex:Integer=-1):Integer;</delphi> Returns number of items in an imagelist. For two-dimensional imagelists ListIndex specifies the sublist for which number of images should be retrieved.

<delphi>function LMDIMLTransparentColor(aList:TCustomImageList;ListIndex:Integer;ImageIndex:Integer=0):TColor;</delphi> Returns Transparent color for imagelist or particular item.

<delphi>function LMDIMLMasked(aList:TCustomImageList;ListIndex:Integer):Boolean;</delphi> Returns masked state for imagelist or particular item.

<delphi>procedure LMDIMLClipDraw(Canvas:TCanvas; target:TRect; flags:WORD; pos:LongInt; transColor:TColor; aList:TCustomImageList; ListIndex, index:Integer);</delphi> Wraps ClipDraw feature of LMD imagelists.