Skip to content

Commit ee63390

Browse files
committed
Merge branch 'hotfix/2.4.7' into main
2 parents 4421322 + c00d8eb commit ee63390

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/MahApps.Metro/Behaviors/WindowsSettingBehavior.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ private void SaveWindowState()
185185
RECT rect;
186186
if (UnsafeNativeMethods.GetWindowRect(hwnd, out rect))
187187
{
188+
var monitor = NativeMethods.MonitorFromWindow(hwnd, MonitorOptions.MONITOR_DEFAULTTONEAREST);
189+
if (monitor != IntPtr.Zero)
190+
{
191+
var monitorInfo = NativeMethods.GetMonitorInfo(monitor);
192+
rect.Offset(monitorInfo.rcMonitor.Left - monitorInfo.rcWork.Left, monitorInfo.rcMonitor.Top - monitorInfo.rcWork.Top);
193+
}
194+
188195
wp.normalPosition = rect;
189196
}
190197
}

0 commit comments

Comments
 (0)