Dynamic control layout tells MegunoLink how to adjust the layout of controls on an Interface Panel visualizer when the size of the visualizer changes. It is useful to ensure all the controls remain accessible when used on computers with smaller displays.

There are 4 methods for dealing with control layout as the size of the visualizer window changes:

  1. scroll bars,
  2. anchoring,
  3. docking, and
  4. flow layout panel.

The first 3 options are implemented by setting properties on controls. The Flow Layout Panel is a control that you can add to your Interface Panel using the Designer. Combine the different options to achieve the layout you want.

Control Layout Properties

The following properties can be edited in the Designer to control layout.

Control layout properties
PropertyTypeAvailable ValuesDefaultDescription
AnchorAnchorStylesTop, Left, Bottom, RightTop, LeftUse the Anchor property to define how a control is automatically resized as its parent control is resized. Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resized.

You can anchor a control to one or more edges of its container. For example, if you anchor a button to both Top and Bottom edges, the height of the button will be changed to maintain the distance to the top and bottom edges of the parent control.
AutoSizeboolTrue | FalseFalseDetermines if the control resizes automatically based on its contents.
AutoSizeModeAutoSizeModeGrowOnly | GrowAndShrinkGrowOnlySpecifies how a control behaves when its AutoSize property is True. If GrowOnly the control will get larger to accommodate its content, but never smaller than the Size property. If GrowAndShrink the control will get bigger or smaller (but not bigger than MaximumSize or smaller than MinimumSize)
DockstringTop | Left | Bottom | Right | Fill | NoneNoneThe control will be docked to an edge of its parent, or fill the space remaining after other controls are docked.
LocationPointPosition of the control, relative to its parent.
MarginPadding3Sets the space between adjacent controls inside layout containers (such as the (Flow Layout Panel).
MaximumSizeSize0, 0The largest size of the control when automatic sizing is enabled.
MinimumSizeSize0, 0The smallest size of the control when automatic sizing is enabled.
PaddingPadding0, 0, 0, 0The amount of space between the control chrome and its content.
SizeSizeThe size of the control.

Layout Examples

Scroll Bar Layout

When a container control’s AutoScroll property is True scroll-bars will be shown automatically if the size of the container becomes smaller than the controls inside it. This applies to:

  • Design surface
  • Panel
  • Flow Layout Panel
  • Split Container
  • Tab Control
  • Table Layout Panel
Auto Scroll

Enable the AutoScroll property to automatically add scroll bars if a container is smaller than its contents.


Scroll bars

Scroll bars are automatically added when the contents are larger than the container

Anchoring Layout

Anchoring locks the distance between one edge of a control and the same edge on its parent. For example, if you anchor the left and right edges of a button on the design surface then the size of the button will grow and shrink as the Interface Panel window is resized.

Anchor

The Anchor property causes the edges of a control to maintain a constant distance to their parent when the parent container is resized.


Anchor

Controls anchored to the edge of their parent container move with the container. Here, the two right buttons are anchored to the right edge of the design surface; the graph is anchored to all four edges.

Docking Layout

Docking a control attaches it either to one edge of its parent container, or causes it to fill its parent container. The control size will change automatically when the parent is resized. A common arrangement is to dock a Panel container to one edge of the design surface and fill the remainder with another control. The Panel provides a container for other controls. Turn on AutoScroll and scroll bars will appear automatically if the Panel becomes smaller than the controls inside it.

Docking

Controls can be docked to one edge, or fill, their parent container.


A purple Panel control is docked to the top edge with a graph Docked to fill the remaining space.

Flow Layout Panel

The Flow Layout Panel is a handy container for other controls. It will layout its content from left to right wrapping the controls to a new line if the Flow Layout Panel is too narrow for its content, by default. Use the FlowDirection property to control the layout direction.

When AutoSize is true, the Flow Layout Panel will grow to accommodate its contents. The Flow Layout Panel is commonly docked to an edge of its parent container with a second control filling the remaining space. This helps make sure the controls inside the panel remain visible when the Interface Panel changes size.

Use the child control’s Margin property to control the spacing between children. For more control over the layout, use a Panel container.

Flow layout panel.

Use a Flow Layout Panel to automatically arrange a collection of controls


Flow Layout Panel.

An orange Flow Layout Panel is docked to the top edge and set to auto-size. The graph is docked to fill the remaining space.

Start typing and press Enter to search