Design a Form people can use
Move from a sketch to a stable control hierarchy, clear input flow and a layout that survives resizing.
Start with one user task#
Write the action the Form must support: “Choose a customer, edit the details, then save or cancel.” That sentence suggests a list, an editor and two clear outcomes. It does not require every available component. Add controls because they support the task, then choose containers that express their relationships.
Choose the parent before positioning#
Left and Top are measured relative to a control’s parent in device-independent points. A Panel, Frame, TabPage or split pane owns its children. A control that merely overlaps a container on the canvas may still belong to the Form; inspect the hierarchy before trying to fix its coordinates.
Design the resize behavior#
| Setting | Use it when | Watch for |
|---|---|---|
| Anchor | A control should keep a distance to selected parent edges. | Opposite anchors can stretch a control. Test its minimum useful width. |
| Dock | A control should occupy an edge or the remaining area. | Dock takes precedence over effective Anchor layout. |
| Margin | The parent layout needs spacing around a child. | Margin is not the same as Left or Top. |
| Min / Max dimensions | The control or Form has practical size limits. | An overly restrictive minimum can make a small screen unusable. |
| FlowLayoutPanel | Similar children should be arranged by a container. | Do not fight automatic arrangement with manual coordinates. |
| ScrollContainer | Some content must remain reachable when space is limited. | Keyboard focus and the last field must still be reachable. |
Test at the initial size, a smaller useful size and a larger size. Check the result at a different display scale if the app depends on tight geometry.
Use a supported Font value#
| Value | Meaning |
|---|---|
| System|22 | System family, size 22. |
| System|22|Bold | Bold weight, normal style. |
| System|22|Italic | Regular weight, italic style. |
| System|22|Bold|Italic | Bold and italic. |
| Empty value | Inherit the theme font. |
The three-part Bold or Italic form is supported from build 840. Sizes must be finite values from 6 through 96 DIP. In the four-part form, weight is Regular or Bold and style is Normal or Italic; do not swap the slots. Test a readable size in the actual running layout.
Read layout advice in context#
An empty-caption Label can be used as a decorative backdrop. Since build 826, AI overlap advice MCB4770 excludes the narrow case in which that Label fully contains the other control. Ordinary partial overlaps and Labels with text are still checked. This exception does not turn a Label into a container: use the intended parent and verify focus, visibility and click behavior in the running app.
Build 828 also prevents non-finite drawing coordinates from crashing Designer preview paths. If a shape looks wrong, inspect its geometry and property values; a preview that remains open is not proof that invalid dimensions are acceptable.
Name controls before writing events#
Use names that describe responsibility, such as txtCustomerName, cmdSave and lblStatus. The name must match every event binding and reference in BASIC. Set user-facing Caption or Text separately. Avoid encoding a position into a name when a later redesign may move it.
Make keyboard order intentional#
Set TabIndex in task order within each parent and use TabStop where a control should be skipped. Give the primary action the appropriate Default behavior and the escape action Cancel behavior. A multiline text field needs Return for editing; test that case rather than assuming the default button always wins.
Then test with the mouse untouched: enter data, correct an error, save and cancel. For a concrete layout, work through the keyboard-friendly dialog.
Practice one layout decision at a time#
Use the Panel lab for parenting, TabControl lab for pages, SplitContainer lab for adjustable panes and FlowLayoutPanel lab for automatic arrangement. Each lesson includes its complete layout configuration.
20f4bfed6b · Build manifestSources & maintenance
Original web explanation, reviewed against these repository sources. API tables and example files follow the implementation.
docs/manual/05-designing-forms.mdmacos/McBasicIDE/Sources/DesignerView.swiftsrc/McBasic.Build/AiReference/AiLayoutAdvisories.cssrc/McBasic.Workspace/AppearanceFont.cs