tags:

views:

65

answers:

1

i have create an imagelist with 20 bitmap inside and a dropdownlist value from 1 to 20. when i select the dropdownlist, it should show the bitmap that corresponding to the dropdownlist index. I'm facing problem that it keep showing the same image when i select the dropdownlist and the image too small. Any idea to slove this problem? and make the image larger?

procedure TForm1.FormShow(Sender: TObject);
var
  i : integer;
begin
  for i:=0 to 20 do begin
    cboIcon.Items.Add(inttostr(i));
  end;
end;

procedure TForm1.cboIconChange(Sender: TObject);
begin
  ImageList1.Draw (Image1.Canvas, 0,0, cboIcon.ItemIndex);
end;
A: 

You can try this code:

Image1.Stretch := true;  // to make it as large as Image1
Image1.Proportional := true;  // to keep with/height ratio
ImageList1.GetBitmap(cboIcon.ItemIndex, Image1.Picture.Bitmap);
Uwe Raabe