Buscar

Icone em um bitbtn

Código

Procedure IcoToBit(ArquivoIco: String; BitBtn: TBitBtn);
Var
  Pic : TPicture;
  Icone : TIcon;
begin
  Icone:= TIcon.Create;
  Pic := TPicture.Create;
try
  Icone.LoadFromFile(ArquivoIco);
  Pic.Icon := Icone;
  BitBtn.Glyph := TBitmap.Create;
  BitBtn.Glyph.Width := Icone.Width;
  BitBtn.Glyph.Height := Icone.Height;
  BitBtn.Glyph.Canvas.Draw(0, 0, Pic.Icon);
finally
  Pic.Free;
  Icone.Free;
end;
end;


{Exemplo: }


procedure TForm1.FormCreate(Sender: TObject);
begin
  IcoToBit('C:Icones95.ico', BitBtn1);
end;

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Object pascal
Adicionada dia: 24/11/07
Por: Fernando
Visualizada: 5649 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009