Skip to content

Commit

Permalink
修复 在有屏幕缩放的屏幕上搜索框位置错误
Browse files Browse the repository at this point in the history
  • Loading branch information
MakesYT committed Jul 30, 2024
1 parent 95321c7 commit 3970c65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core.Window/WindowToolServiceWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public void MoveWindowToMouseScreenCenter(Avalonia.Controls.Window window)
var monitorInfo = new User32.MONITORINFO();
monitorInfo.cbSize = 40;
User32.GetMonitorInfo(hmonitor, ref monitorInfo);

User32.GetWindowRect(window.TryGetPlatformHandle().Handle, out var windowRect);
window.Position =
new PixelPoint(
(monitorInfo.rcMonitor.Left + (int)((monitorInfo.rcMonitor.Width - window.Bounds.Width) / 2)),
(monitorInfo.rcMonitor.Left + (int)((monitorInfo.rcMonitor.Width - windowRect.Width) / 2)),
monitorInfo.rcMonitor.Top + monitorInfo.rcMonitor.Height / 4);
}
}

0 comments on commit 3970c65

Please sign in to comment.