Fix(server): size status bar panes from measured text

The FRP/runtime/expiry panes kept fixed 250/180/180 pixel widths while the
text is drawn with a system font that changes with language, display
scaling and accessibility text size. Where the font is larger the expiry
text is cut inside the pane: "到期: 2026-12-31 (41天)" shows the date but
drops the remaining days, and the wider English "Expires: 2026-12-31 (41d)"
stays cut on another machine.

Measure each pane's text as wide characters (the status bar control is
Unicode internally; ANSI measurement is up to 10% narrower for CJK) against
several candidate fonts - the pane's own font, SYSTEM_FONT, DEFAULT_GUI_FONT,
lfStatusFont and lfMessageFont - and take the widest. Widths never drop below
the previously proven 250/180/180, so 100% scaling layouts are unchanged, and
the expiry pane gets an extra 20px with a 220px floor for the longer English
string.

A new LayoutStatusPanes() applies the widths in one place and, when their sum
exceeds the bar, hides panes in priority order (runtime -> FRP -> MCP -> TLS)
so the last pane cannot be clipped at the window edge. OnSize, the periodic
refresh and the FRP auto-proxy start/stop all go through it now.

Verified with Release x64 builds; visual confirmation on the affected
machines is still pending.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-21 12:31:38 +01:00
1 parent de9e9a7369
commit 798456032e
2 files changed
+132 -49

No files matched your search

+4
View File
@@ -479,7 +479,11 @@ public:
CString m_strFrpAddr; // FRP 地址 (IP:Port),由上级提供
int m_nPaneTlsWidth = 60; // 状态栏 TLS 分区宽度(按当前语言实测文本宽度)
int m_nPaneMcpWidth = 60; // 状态栏 MCP 分区宽度(按当前语言实测文本宽度)
int m_nPaneFrpWidth = 250; // 状态栏 FRP 分区宽度(按当前文本实测)
int m_nPaneRuntimeWidth = 180; // 运行统计分区宽度(按最长可能文本实测)
int m_nPaneExpireWidth = 0; // 到期时间分区宽度(按当前文本实测;0 = 无授权/隐藏)
void UpdateStatusBarStats(); // 更新状态栏统计信息
void LayoutStatusPanes(); // 按窗口宽度布置状态栏分区(空间不足时按优先级隐藏)
CTrueColorToolBar m_ToolBar;
CGridDialog * m_gridDlg = NULL;
std::vector<DllInfo*> m_DllList;