有谁知道怎么能在按钮上加ICO图片
有谁知道怎么能在按钮上加ICO图片
bitcmd只能加BMP但我觉得BMP不好
以下是代码:
var
Form1: TForm1;
freeCanvas : TCanvas;
freeIcon : TIcon;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
freeCanvas := TCanvas.Create;
freeCanvas.Handle := getDC(button1.Handle);
freeIcon := TIcon.Create;
freeIcon.LoadFromFile('icon.ico'); //Your icon's path;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
button1.Refresh;
freeCanvas.Draw(0, 0, freeIcon);
end;