Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Change bitmap at runtime
The simplest way to change bitmap at runtime is to use Assign method. Keep in mind, that when a property is an object, it has memory associated with it.The memory associated with the old value has to be freed, the new memory has to be allocated.
procedure TForm1.Button1Click(Sender: TObject);
var
Image: TBitmap;
begin
Image:=TBitmap.Create;
if N<ImageList1.Count then ImageList1.GetBitmap(N,Image);
BitBtn1.Glyph.Assign(Image);
Inc(N);
if N>ImageList1.Count then N:=0;
Image.Free;
end;
-
More for developers