ImageEn, unit iemview

TImageEnMView.ImageID

TImageEnMView.ImageID


Declaration


property ImageID[idx: Integer]: integer;


Description


ImageID associates a numeric ID with image, idx. It is mainly used to allow dynamic loading of content into a TImageEnMView.
This ID is returned in the OnImageIDRequest and OnImageIDRequestEx events.

Note: ImageFilename is not valid when using ImageID.


Demo


  Demos\Multi\Multi-OnDemand\MViewOnRequest.dpr



Example


// Display all bitmaps in a TImageList in a TImageEnView
procedure TMyForm.FormShow(Sender: TObject);
var
  I : Integer;
begin
  ImageEnMView1.Clear;

  // Add an ID for every bitmap in a TImageList
  for I := 0 to ImageList1.Count - 1 do
  begin
    ImageEnMView1.InsertImage(I);
    ImageEnMView1.ImageID[I] := I;
  end;
end;

procedure TMyForm.ImageEnMViewOnImageIDRequest(Sender: TObject; ID: integer; var Bitmap: TBitmap);
begin
  // Retrieve the image from a TImageList
  Bitmap := TBitmap.create;
  ImageList1.GetBitmap(ID, Bitmap);
end;