Updated: Dec 16, 2023
Follow on twitter

TsAlphaImageList

This component is an analogue of standard TImageList component, but there are some significant differences:

  • Changing of Height and Width properties without loss of icons.
  • It's possible to use this component as a storage of images with different sizes.
  • Allowed formats of icons: Ico, Png and Bmp 32bpp.
  • Images are embedded in executable file in the original format (with compression).
  • Support of the NumGlyphs property in buttons.

Component methods

procedure AcBeginUpdate;

Suppresses an output of images, used when component is in changing usually.

procedure AcEndUpdate(DoChange: boolean = True);

Allows an output of images, used for unlock of component after the AcBeginUpdate procedure calling. If the DoChange parameter is True, then repainting command is sent to all components, linked with this ImageList.

function GetBitmap32(Index: Integer; Image: TBitmap): Boolean;

Returns to the Image an Icon by Index with converting to Bitmap 32bpp format. If function is executed with success then result is True.

function CreateBitmap32(Index: Integer; aWidth, aHeight: integer): TBitmap;

Creates a Bitmap 32bpp with specified size, based on the icon from ImageList. If function is executed with success then result is not Nil.

procedure MoveItem(CurIndex, NewIndex: integer);

Changes a position of the icon in the list.

TsVirtualImageList

Component allows to receive an images with specified size with using of the TsAlphaImageList component as a source of images. TsVirtualImageList component does not stores images, but takes them from component defined in the AlphaImageList property.

Sample of using of the TsVirtualImageList with TsAlphaImageList may be downloaded there (3.7 Mb).

Component methods

procedure AcBeginUpdate;

Suppresses an output of images, used when component is in changing usually.

procedure AcEndUpdate(DoChange: boolean = True);

Allows an output of images, used for unlock of component after the AcBeginUpdate procedure calling. If the DoChange parameter is True, then repainting command is sent to all components, linked with this ImageList.

function GetBitmap32(Index: Integer; Image: TBitmap): Boolean;

Returns to the Image an Icon by Index with converting to Bitmap 32bpp format. If function is executed with success then result is True.

function CreateBitmap32(Index: Integer; aWidth, aHeight: integer): TBitmap;

Creates a Bitmap 32bpp with specified size, based on the icon from ImageList. If function is executed with success then result is not Nil.

TsCharImageList

The ImageList component where chars from fonts used as source for glyphs.

This component may be used as usual ImageList component for showing of glyphs in buttons, menus and any other elements of the application.

Custom font may be embedded into this component by few clicks of mouse and may be used as source of glyphs on other machines.

The TsCharImageList component has the popular symbol font embedded as default ('FontAwesome' font license). This font is free, has more than 700 icons and may be used as source of icons in all projects where the TsCharImageList component is available.

Work of the component and design-time editor may be viewed in the Compiled demo (the "ImageLists" page).

Component methods

procedure AcBeginUpdate;

Suppresses an output of images, used when component is in changing usually.

procedure AcEndUpdate(DoChange: boolean = True);

Allows an output of images, used for unlock of component after the AcBeginUpdate procedure calling. If the DoChange parameter is True, then repainting command is sent to all components, linked with this ImageList.

function GetBitmap32(Index: Integer; Image: TBitmap): Boolean;

Returns to the Image an Icon by Index with converting to Bitmap 32bpp format. If function is executed with success then result is True.

function CreateBitmap32(Index: Integer; aWidth, aHeight: integer): TBitmap;

Creates a Bitmap 32bpp with specified size, based on the icon from ImageList. If function is executed with success then result is not Nil.

function CreateBitmap32Color(Index: Integer; aWidth, aHeight: integer; CharColor: TColor): TBitmap;

Creates a Bitmap 32bpp with specified color and size, based on the icon from ImageList. If function is executed with success then result is not Nil.

Procedures and functions of the unit

function DrawAlphaImgList(const ImgList: TCustomImageList; const DestBmp: TBitmap; const Left: integer; const Top: integer; const ImageIndex: integer; const Blend: integer; const GrayedColor: TColor; State: integer; const NumGlyphs: integer; const Reflected: boolean): TSize;

Draws an image from ImgList, which defined by ImageIndex, to the DestBmp in the Bitmap 32bpp. Output of images may be produced with several effects, such as semitransparency, reflection and others. Result of function is a size of the image.

  • Left and Top parameters specifies coords of the top left corner, where should be drawn the image.
  • State specifies a number of state for which the icon will be drawn. Such effects as semitransparency and color tone may be produced only if State is 0.
  • NumGlyphs specifies a count of states in the one image. This property works same as NumGlyphs property in the standard TBitBtn component.
  • Blend defines a level of the image transparency (0..100). If this property is 0 or if State <> 0, them image will be drawn as is, without a transparency. The sample shows images with Blend = 0 and 50.
  • GrayedColor specifies a color tone for an icon. If GrayedColor is clNone or State <> 0, then icons will be drawn as is, without changes. The lighter color makes more clear icon. Below are shown samples of icons with clNone and $C9CED8 colors.
  • Reflected enables a reflection for the icon. On a sample are shown icons with enabled and with disabled Reflected parameter.

procedure DrawAlphaImgListDC(const ImgList: TCustomImageList; const DC: hdc; const Left: integer; const Top: integer; const ImageIndex: integer; const Blend: integer; const GrayedColor: TColor; const State: integer; const NumGlyphs: integer; const Reflected: boolean);

A full analog of the previous function. Difference is in destination only. Output produced to the DeviceContext handle in this procedure (DC: hdc).

function AddImageFromRes(aInstance: LongWord; ImageList: TsAlphaimageList; const ResName: String; ImageFormat: TsImageFormat): Boolean;

Loads the Png icon from resource to the ImageList. Resource image is defined by ResName: String and should be compiled as RcData.


Installing, using and licensing the demo programs © Sergii Goncharov, Ukraine, Odessa 2004-2023