RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomImageList.GetBitmap Method

Retrieves a specified image as a bitmap.

Pascal
function GetBitmap(Index: Integer; Image: TBitmap): Boolean;
C++
__fastcall Boolean GetBitmap(int Index, TBitmap Image);

Use the GetBitmap method to obtain a particular image in the image list as a bitmap object. Index denotes the index of the image. GetBitmap assigns the image to the TBitmap object passed in as the Image parameter.  

C++ Examples: 

 

/*
This example assigns a bitmap contained in an ImageList to
an Image component's Picture's Bitmap property and displays
the bitmap.  TImage Stretch will fit the bitmap to the image
size.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  ImageList1->GetBitmap(0, Image1->Picture->Bitmap);
  Image1->Stretch = True;
}

 

Delphi Examples: 

{
This example assigns a bitmap contained in an ImageList to
an Image component's Picture's Bitmap property and displays
the bitmap.  TImage Stretch will fit the bitmap to the image
size.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
   ImageList1.GetBitmap(2,Image1.Picture.Bitmap);
   Image1.Stretch := True;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!