I have tried almost everything, still, unable to resize the image before displaying it in a toolbar button, so far I have this code:
function TMainForm.LoadIcon(IconName: string): boolean;
var IconImage: TImage;
var IconPath: string;
begin
IconPath := Concat(ExtractFilePath(ParamStr(0)), AssetsBase, Concat(IconName, '.png'));
IconImage := TImage.Create(self);
try
IconImage.Stretch := True;
IconImage.Proportional := True;
IconImage.Center := True;
IconImage.Width := 32;
IconImage.Height := 32;
IconImage.Picture.LoadFromFile(IconPath);
MainToolbarImageList.Add(IconImage.Picture.Bitmap, nil);
finally
IconImage.Free;
end;
LoadIcon := True;
end;