Skip to content

Commit cf9df38

Browse files
authored
Fix: Status window with display scaling (#3185)
* Fix: #3183 * Docs: #3185 * Update StatusWindow.xaml.cs
1 parent d30f56a commit cf9df38

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Source/NETworkManager/StatusWindow.xaml.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
using System;
1+
using NETworkManager.Settings;
2+
using NETworkManager.Utilities;
3+
using NETworkManager.Views;
4+
using System;
25
using System.ComponentModel;
36
using System.Runtime.CompilerServices;
47
using System.Windows.Forms;
58
using System.Windows.Input;
69
using System.Windows.Threading;
7-
using log4net;
8-
using NETworkManager.Settings;
9-
using NETworkManager.Utilities;
10-
using NETworkManager.Views;
1110

1211
namespace NETworkManager;
1312

@@ -43,7 +42,7 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = null)
4342
#endregion
4443

4544
#region Variables
46-
45+
4746
// Set priority to make the ui smoother
4847
private readonly DispatcherTimer _dispatcherTimerClose = new(DispatcherPriority.Normal);
4948

@@ -142,16 +141,18 @@ public void ShowWindow(bool enableCloseTimer = false)
142141
// ToDo: User setting...
143142
if (Screen.PrimaryScreen != null)
144143
{
145-
Left = Screen.PrimaryScreen.WorkingArea.Right - Width - 10;
146-
Top = Screen.PrimaryScreen.WorkingArea.Bottom - Height - 10;
144+
var scaleFactor = System.Windows.Media.VisualTreeHelper.GetDpi(this).DpiScaleX;
145+
146+
Left = Screen.PrimaryScreen.WorkingArea.Right / scaleFactor - Width - 10;
147+
Top = Screen.PrimaryScreen.WorkingArea.Bottom / scaleFactor - Height - 10;
147148
}
148149

149150
// Show the window
150151
Show();
151-
152+
152153
// Check the network connection
153154
Check();
154-
155+
155156
// Close the window after a certain time
156157
if (enableCloseTimer)
157158
{

Website/docs/changelog/next-release.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Release date: **xx.xx.2025**
3434

3535
## Bug Fixes
3636

37+
- Fixed an issue where the status window was out of screen when a display scale other than 100% was set. [#3185](https://github.com/BornToBeRoot/NETworkManager/pull/3185)
38+
3739
**Web Console**
3840

3941
- Fixed a crash that occurred when clearing the browser cache. [#3169](https://github.com/BornToBeRoot/NETworkManager/pull/3169)

0 commit comments

Comments
 (0)