- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

How do I create a bitmap from an icon?

Question:

How do I create a bitmap from an icon?

Answer:

Use Bitmap.Canvas.Draw to draw the icon on the Bitmap.

Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  TheIcon : TIcon;
  TheBitmap : TBitmap;
begin
  TheIcon := TIcon.Create;
  TheIcon.LoadFromFile('C:\Program Files\Borland\IcoCur32\EARTH.ICO');
  TheBitmap := TBitmap.Create;
  TheBitmap.Height := TheIcon.Height;
  TheBitmap.Width := TheIcon.Width;
  TheBitmap.Canvas.Draw(0, 0, TheIcon);
  Form1.Canvas.Draw(10, 10, TheBitmap);
  TheBitmap.Free;
  TheIcon.Free;
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile