You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app: open at a sensible size, centred
WinUI picks its own default, which on a 4K display came out around 1766 wide —
roughly half the screen for a window whose widest page needs about 880.
1040x760, sized off the Camera page since it is the constraint: a 210 label, a 300
slider, a 96 readout and the gaps, plus page padding and the 190 pane. A minimum
size stops it being dragged narrower than its own content, and it centres on the
work area rather than the display so it cannot land under the taskbar.
⚠️ AppWindow.Resize takes PHYSICAL pixels, not DIPs. Passing a comfortable number
straight in looks correct on a 100% display and gets progressively smaller as
scaling rises — the opposite of what the call appears to do. The size is scaled by
the window's DPI for that reason. On the 4K display this was measured against the
scale is 1, so that path is reasoned rather than observed; a scaled display would
be the thing to check if it ever looks wrong.
Uses DllImport rather than LibraryImport for GetDpiForWindow: the source-generated
form requires AllowUnsafeBlocks, which is a lot of blast radius for one call that
returns a number.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>