winforms-high-dpi-fluent-layout

Designs responsive DPI-aware WinForms layouts using TableLayoutPanel and FlowLayoutPanel patterns.

1|1|Updated Jun 12, 2022
One-click install
npx skills add https://github.com/KlausLoeffelmann/WinFormsDevTools --skill winforms-high-dpi-fluent-layout-klausloeffelmann
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: winforms-high-dpi-fluent-layout
Source: https://github.com/KlausLoeffelmann/WinFormsDevTools/tree/main/.github/skills/winforms-high-dpi-fluent-layout
Command: npx skills add https://github.com/KlausLoeffelmann/WinFormsDevTools --skill winforms-high-dpi-fluent-layout-klausloeffelmann

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? WinForms forms often break when resized, moved between monitors with different DPI scaling, or localized into longer languages. This Skill provides concrete layout patterns and Designer-compatible code so forms scale correctly, buttons never clip text, and window state is saved and restored properly. ## Core Features & Use Cases - Fluent Layout Patterns: Nested TableLayoutPanel and FlowLayoutPanel strategies with correct AutoSize, Percent, and Absolute sizing rules, plus Anchor-based cell placement. - Designer-Compatible Code: All examples keep control configuration inside InitializeComponent in the .Designer.cs file so the WinForms Designer never breaks. - High-DPI and Window Management: Per Monitor V2 awareness, fullscreen/kiosk mode state handling, modal dialog patterns, and RestoreBounds-based window position persistence. - Use Case: You are building a settings dialog with grouped radio buttons and OK/Cancel buttons that must render correctly at 150% DPI scaling and in German localization. Apply the RadioButton cluster and ButtonContainer patterns to get uniform, non-clipping, scalable controls. ## Quick Start Use the winforms-high-dpi-fluent-layout skill to redesign my settings form with a nested TableLayoutPanel that scales correctly on high-DPI monitors.

Frequently Asked Questions about winforms-high-dpi-fluent-layout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a responsive WinForms layout with TableLayoutPanel?▼

Use nested TableLayoutPanels with AutoSize for caption columns, Percent for content columns, and Anchor (never Dock) on controls inside cells. Keep individual panels to 2-4 columns and group sections with GroupBoxes containing their own layouts.

How to make WinForms buttons the same size without text clipping?▼

Set AutoSize with GrowAndShrink on each button and anchor them within an AutoSize TableLayoutPanel row. For reusable uniform sizing, use a FlowLayoutPanel-derived ButtonContainer that computes the maximum PreferredSize and applies it as each button's MinimumSize.

Why does my WinForms form appear offset when entering fullscreen?▼

The offset happens when fullscreen state variables are not initialized before the first fullscreen call. Store WindowState and FormBorderStyle in the constructor before calling EnterFullscreen, then set FormBorderStyle to None and WindowState to Maximized.

Does TableLayoutPanel support Dock for controls inside cells?▼

No, controls in TableLayoutPanel cells must use Anchor instead of Dock. Docking inside cells breaks the layout engine's sizing calculations; Anchor with the appropriate sides achieves correct stretching behavior.

How do I save and restore WinForms window position correctly?▼

Use Form.RestoreBounds instead of Location and Size, because those return incorrect values when the form is maximized or minimized. Read RestoreBounds during the FormClosing event and restore position, size, and WindowState in OnLoad.

Why does extracting control setup into helper methods break the WinForms Designer?▼

The WinForms Designer only parses InitializeComponent in the .Designer.cs file. Moving control instantiation or property assignment into helper methods like CreateDetailsPanel makes those controls invisible to the Designer and breaks serialization.