Files
ETTerms/src
etwenandClaude Opus 4.8 46cb7a5662 fix(ui): Scale every hardcoded pixel size to the actual display DPI
At Windows display scaling above 100% (125%/150%, common on laptops), fonts
grew with the scale but hardcoded pixel sizes did not: the Log/Script/Stop
buttons on each session were truncated, the AI Chat toolbar button lost its
bottom edge at 150%, and absolute-coordinate dialogs (Quick Connect / New
Connection) could clip or overlap their fields.

Root cause: MainForm's AutoScaleMode.Dpi scales only the controls that exist
when the form initializes. Almost all of this app's UI is created at runtime
(SessionPage on open, views built in constructors after InitializeComponent),
so nothing was ever scaled — verified at 125%: the 250px sidebar stayed 250px.

Fix, in order of preference:
- New Theme.Dpi(Control, px) extension (px * DeviceDpi/96, same approach as
  the existing ActivityRail.ItemSize) applied to every hardcoded dimension:
  sidebar, toolbars, tab strips, Settings inputs and grids, PDU status grid,
  AI chat pane, Ctrl+F search bar, DarkScrollBar width.
- Buttons whose text changes at runtime (Log <-> Logging, Log All <->
  Logging All) now size from measured text width (SessionPage.BarButtonWidth)
  or plain AutoSize, so they can never truncate at any scale.
- Multi-line instruction labels switch to AutoSize instead of fixed frames.
- Absolute-coordinate dialogs get DarkDialog.ApplyDpiScale(): one recursive
  Control.Scale(DeviceDpi/96) at the end of each constructor.
- MainForm moves to AutoScaleMode.None with ClientSize/MinimumSize scaled
  manually — we own scaling explicitly, so a future .NET change to auto-scale
  semantics cannot double-scale us.

At 100% the conversion is the identity, so existing setups are unchanged.
Known limitation: changing the system scale while running needs an app
restart (no WM_DPICHANGED re-layout).

Also rides along in AboutView: the v0.7.2 changelog entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MKF7C75bhA4ArQhyMpnsxU
2026-07-16 13:46:29 +08:00
..