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: branches/fixes_2_0@62397 -
This commit is contained in:
mattias 2019-12-14 18:08:14 +00:00
parent 5f7d7361bc
commit e8fbe92d36
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;