Topic: [Script] Own icons for buttons
Own icons for buttons
var
ImageList: TImageList;
begin
// create new ImageList
ImageList:=TImageList.Create(Form1);
ImageList.Masked:=false;
ImageList.ColorDepth:=cd32bit;
// size of images
ImageList.Width := 16;
ImageList.Height := 16;
// load images
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\key.png'); // 0 - index if image
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\accept.png'); // 1
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\link.png'); // 2
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\window.png'); // 3
// Change ImageList for buttons
Form1.Button1.Images := ImageList;
Form1.Button2.Images := ImageList;
Form1.Button3.Images := ImageList;
Form1.Button4.Images := ImageList;
Form1.Button5.Images := ImageList;
Form1.Button6.Images := ImageList;
// Select images for buttons
Form1.Button1.ImageIndex := 0;
Form1.Button2.ImageIndex := 1;
Form1.Button3.ImageIndex := 2;
Form1.Button4.ImageIndex := 3;
Form1.Button5.ImageIndex := 3;
Form1.Button6.ImageIndex := 3;
end.
Project example: