TIconAssignTo (Delphi)
Description
This example demonstrates the use of the AssignTo method of the TIcon class to copy the image stored in an icon to a bitmap.
Code
procedure TMainForm.FormCreate(Sender: TObject);
var
Icon: TIcon;
Bmp: TBitmap;
begin
{ Create an icon and load it from file. }
Icon := TIcon.Create();
Icon.LoadFromFile('test_icon.ico');
{ Create a bitmap from the loaded icon. }
Bmp := TBitmap.Create();
Icon.AssignTo(Bmp); { Equivalent to Bmp.Assign(Icon) }
{ Assign the bitmap to the image on the form. }
Image1.Picture.Assign(Bmp);
{ Free the intermediary objects. }
Icon.Free;
Bmp.Free;
end;
Uses
- Vcl.Graphics.TIcon.AssignTo ( fr | de | ja )