Skip to content

Commit

Permalink
Improve method of getting image from collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Apr 2, 2021
1 parent ca78544 commit 826f028
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Projects/CompStartup.pas
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ procedure TStartupForm.SetMRUFilesList(const MRUFilesList: TStringList);

procedure TStartupForm.UpdateImages;

function GetBitmap(const Button: TToolButton; const WH: Integer): TBitmap;
function GetImage(const Button: TToolButton; const WH: Integer): TWICImage;
begin
Result := CompileForm.LightToolBarImageCollection.GetBitmap(Button.ImageIndex, WH, WH)
Result := CompileForm.LightToolBarImageCollection.GetSourceImage(Button.ImageIndex, WH, WH)
end;

var
WH: Integer;
begin
{ After a DPI change the button's Width and Height isn't yet updated, so calculate it ourselves }
WH := MulDiv(16, CurrentPPI, 96);
NewImage.Picture.Bitmap := GetBitmap(CompileForm.NewMainFileButton, WH);
OpenImage.Picture.Bitmap := GetBitmap(CompileForm.OpenMainFileButton, WH);
NewImage.Picture.Graphic:= GetImage(CompileForm.NewMainFileButton, WH);
OpenImage.Picture.Graphic := GetImage(CompileForm.OpenMainFileButton, WH);
end;

procedure TStartupForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI,
Expand Down

0 comments on commit 826f028

Please sign in to comment.