Skip to content

Commit 3c40be0

Browse files
committed
chore: 1080p 竖屏限制高度
1 parent e5c5aa9 commit 3c40be0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

MaiChartManager/Browser.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public Browser(string? loopbackUrl = null)
2727
webView21.Source = new Uri("https://mcm.invalid/index.html");
2828
webView21.DefaultBackgroundColor = Color.Transparent;
2929
IapManager.BindToForm(this);
30+
31+
// 竖屏显示器时,限制窗口高度不超过显示器宽度的 2/3
32+
var landscape = Screen.AllScreens.FirstOrDefault(s => s.WorkingArea.Width >= s.WorkingArea.Height);
33+
if (landscape == null)
34+
{
35+
var portrait = Screen.PrimaryScreen ?? Screen.AllScreens[0];
36+
var maxHeight = portrait.WorkingArea.Width * 2 / 3;
37+
if (Height > maxHeight)
38+
Height = maxHeight;
39+
}
40+
3041
StartPosition = FormStartPosition.Manual;
3142
Location = WebViewHelper.CalculatePosition(Width, Height);
3243
}

0 commit comments

Comments
 (0)