Layout

A window that looks right at one size and falls apart at another is a layout bug, and WinForms has a small set of tools against it: anchoring, docking, the container controls, and the two layout panels. These seven lessons also cover the numbers behind them, margin and padding, the DPI mode and the font, which is where a form that looks right on one monitor breaks on the next.

023 Anchor and Dock the two properties, DockStyle, the order docking is applied, Padding Open 024 Panel and the Controls collection Parent, Controls, BringToFront and SendToBack, nested containers Open 025 SplitContainer Panel1 and Panel2, Orientation, SplitterDistance, FixedPanel, a resizable two-pane window Open 026 TableLayoutPanel rows and columns, RowSpan and ColumnSpan, percent sizes, a form that scales Open 027 FlowLayoutPanel and AutoSize FlowDirection, WrapContents, AutoSize and AutoSizeMode, AutoScroll Open 028 TabControl TabPages, SelectedIndex, SelectedTab, a page per document, the events Open 029 Margin, padding, DPI and fonts Margin against Padding, AutoScaleMode, DeviceDpi, HighDpiMode, PerMonitorV2, the default font Open

Lessons