LCL: Fix TSpeedButton and TBitBtn using non-scaled icons if an Action is assigned to these controls (https://forum.lazarus.freepascal.org/index.php/topic,47574.msg340909.html).

git-svn-id: trunk@62311 -
This commit is contained in:
wp 2019-11-28 17:58:24 +00:00
parent bb24841e59
commit 733d74e407
2 changed files with 12 additions and 2 deletions

View File

@ -200,6 +200,8 @@ begin
end;
procedure TCustomBitBtn.ActionChange(Sender: TObject; CheckDefaults: Boolean);
var
ImagesRes: TScaledImageListResolution;
begin
inherited ActionChange(Sender,CheckDefaults);
if Sender is TCustomAction then
@ -208,7 +210,10 @@ begin
begin
if (Glyph.Empty) and (ActionList <> nil) and (ActionList.Images <> nil) and
(ImageIndex >= 0) and (ImageIndex < ActionList.Images.Count) then
ActionList.Images.GetBitmap(ImageIndex, Glyph);
begin
ImagesRes := ActionList.Images.ResolutionForPPI[ImageWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
ImagesRes.GetBitmap(ImageIndex, Glyph);
end;
end;
end;
end;

View File

@ -419,6 +419,8 @@ end;
procedure TCustomSpeedButton.ActionChange(Sender: TObject;
CheckDefaults: Boolean);
var
ImagesRes: TScaledImageListResolution;
begin
inherited ActionChange(Sender,CheckDefaults);
if Sender is TCustomAction then
@ -429,7 +431,10 @@ begin
Self.GroupIndex := GroupIndex;
if (Glyph.Empty) and (ActionList <> nil) and (ActionList.Images <> nil) and
(ImageIndex >= 0) and (ImageIndex < ActionList.Images.Count) then
ActionList.Images.GetBitmap(ImageIndex, Glyph);
begin
ImagesRes := ActionList.Images.ResolutionForPPI[ImageWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
ImagesRes.GetBitmap(ImageIndex, Glyph);
end;
end;
end;
end;