ImageEn, unit iemview

TIEGetButtonEvent


Declaration

type TIEGetButtonEvent = procedure(Sender: TObject; ThumbIndex, ButtonIndex: integer; var Bitmap: TIEBitmap) of object;


Description

Occurs whenever a thumbnail button is being drawn. You must pass an image to use as a button.

ThumbIndex is the index of the image being drawn (i.e. 0 for first image in the grid, 1 for second, etc.)
ButtonIndex is the index of the button being drawn (0 for the left-most button, etc).
Bitmap is the destination for your button image (it is already created, and automatically freed).

Note: A button is only drawn if it has been modified, so to hide the button for a specific ThumbIndex do not set bitmap


Example

procedure TMainForm.GetThumbButton(Sender: TObject; ThumbIndex, ButtonIndex: Integer; var Bitmap: TIEBitmap);
var
  imgIndex: Integer;
  ico: TIcon;
begin
  // Get bitmap from TImageList
  imgIndex := ButtonIndex;
  if not ThumbButtonEnabled( ButtonIndex ) then
    inc( imgIndex, 3 );

  // Can do this if don't need alpha transparency
  // ImageList1.GetBitmap( imgIndex, Bitmap.VclBitmap );

  ico := TIcon.create;
  TImageList( ImageList1 ).GetIcon( imgIndex , ico );
  Bitmap.Assign( ico );
  ico.Free;
end;