Board index » delphi » How button can get icon

How button can get icon

Hello all
I tried to insert icon for button (BitButton, Speedbutton...) However, they
only accept Bitmap picture. Could you please tell me how to insert *.ico
for them
Thank you for your help
Nhuyen

http://www.zfree.co.nz

 

Re:How button can get icon


You need to copy the icon to the bitmap of the button, e.g.

var
  Icon: TIcon;
begin
  Icon := TIcon.Create;
  try
    Icon.LoadFromFile(someicon.ico');
    SpeedButton1.Glyph.Width := Icon.Width;
    SpeedButton1.Glyph.Height := Icon.Height;
    SpeedButton1.Glyph.Canvas.Draw(0, 0, Icon);
  finally
    Icon.Free;
  end;
end;

Quote
"NHuyen" <sonphu...@zfree.co.nz> wrote in message

news:3baff590$1@zfree.co.nz...
Quote

> Hello all
> I tried to insert icon for button (BitButton, Speedbutton...) However,
they
> only accept Bitmap picture. Could you please tell me how to insert *.ico
> for them
> Thank you for your help
> Nhuyen

> http://www.zfree.co.nz

Other Threads