windowsforms-3271-controls-and-libraries-form-layout-managers-layout-and-data-layout-controls-layout-control-converting-a-regular-layout-of-controls-to-an-xtralayoutcontrol.md
With a few mouse clicks, you can easily convert an existing regular layout of controls to a Layout Control, and vice versa. All you need to do is to place a LayoutConverter component on your form (or UserControl), and then use its commands to perform a conversion. The following image shows a LayoutConverter’s commands.
The LayoutConverter component only provides design-time functionality. It serves no purpose at runtime. So, after converting a layout you can freely delete the LayoutConveter component.
When choosing this command, the LayoutConverter first asks you to choose the container that displays the controls to be converted to a Layout Control. The following containers are supported:
Note
Empty containers cannot be selected.
After selecting a container, all its controls are moved to a new LayoutControl. During the conversion, the LayoutConveter tries to retain the relative distances between controls in the output layout as close as possible to the original layout. However, due to control arrangement rules that the Layout Control follows, specific regular layouts may not be exactly reproduced using a LayoutControl.
The selected container’s children are converted as follows:
GroupBox and GroupControl objects are converted to LayoutControlGroup objects. The contents of these controls are also processed and converted accordingly.
TabControl and XtraTabControl objects are converted to TabbedControlGroup objects. The contents of these controls are also processed and converted accordingly.
Panel and PanelControl objects are converted to LayoutControlItem objects. The contents of these containers are not processed.
If a label (Label or LabelControl) is displayed on the left of a control, the label and the control will be represented by a single LayoutControlItem object.
Other objects are converted to LayoutControlItem objects.
This command does the opposite operation - it moves controls from an existing Layout Control to the form (or UserControl). First, you’re asked to select a LayoutControl control to be converted to a regular layout. After selecting a LayoutControl, all its controls are moved to the current form (or UserControl) and then the LayoutControl is destroyed. During this kind of conversion, the positions of controls in the output layout will be the same as in the original layout.