Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
new scaling solution
Browse files Browse the repository at this point in the history
more hard-coded than I would like but seems to be more accurate
  • Loading branch information
Michael Higgins committed Dec 5, 2020
1 parent b947e2f commit 783a8fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CenterTaskbar/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,13 @@ private bool PositionLoop(AutomationElement trayWnd)
return true;
}

var iconSizeSetting = (int)Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSmallIcons", 0);
var iconSizeHorizontal = (iconSizeSetting == 0) ? 40 : 30;
var iconSizeVertical = (iconSizeSetting == 0) ? 47 : 31;

var scale = horizontal
? first.Current.BoundingRectangle.Top / trayBounds.Top
: first.Current.BoundingRectangle.Left / trayBounds.Left;
? first.Current.BoundingRectangle.Height / iconSizeHorizontal
: first.Current.BoundingRectangle.Height / iconSizeVertical;
Debug.WriteLine("UI Scale: " + scale);
var size = (lastChildPos - (horizontal
? first.Current.BoundingRectangle.Left
Expand Down

0 comments on commit 783a8fa

Please sign in to comment.