Other DevExpress WinForms Cheat Sheets
Layout Manager (LayoutControl) displays controls with the help of layout items. It handles the size and position of layout items (controls) to prevent item overlapping and misalignment.
Layout Manager assigns size constraints to layout items (controls). You can manipulate controls' size constraints using the context menu, Control.MinimumSize, Control.MaximumSize, LayoutControlItem.SizeConstraintsType, LayoutControlItem.MinSize, and LayoutControlItem.MaxSize properties.
Default size constraints allow the controls to occupy all the available space in the horizontal direction, while the height of many controls is fixed (for example, the default height of data editors is fixed and equals 20px).
The maximum width and height of many controls (for example, MemoEdit, GridControl, and TabControl) is not limited. These controls are easily resized horizontally and vertically whenever you resize the Layout Control.
Examples
During resize operations (at design time and in customization mode at runtime), Layout Control highlights items that have reached their minimum/maximum size (thus, they cannot be resized any further).
When you focus a control at design time, Layout Manager displays special icons if the control's size constraints prohibit resize operations.
If an item is not resized, make sure that the item size is not locked due to Size Constraints.
Tip: You can add Empty Space Item (a resizable area) next to a layout item to allow the item to be resized and to align an item to a specific edge of its parent.
LayoutControl displays scrollbars when Size Constraints are applied to controls or layout items. So, make sure that:
- The Control.MinimumSize property isn't set.
- The LayoutControlItem.SizeConstraintsType property of corresponding items isn't set to Custom, and their LayoutControlItem.MinSize isn't specified either.
You can specify custom minimum and/or maximum width and height for controls hosted within Layout Manager.
To restrict the minimum size of controls, set the Control.MinimumSize property.
To restrict the maximum size of controls, set the Control.MaximumSize property.
Set the width and/or height of the Control.MinimumSize/Control.MaximumSize property to 0 to remove constraints on the control's minimum/maximum width or height.
See the following help topic for more information: Size and Alignment.
A group's size is specified by the size of its nested layout items. Size constraints applied to layout items can prevent the group from being resized. To allow the group to be resized, you can do either of the following:
- If the maximum width/height of controls is limited, remove these limits.
- Add Empty Space Item to the group.
Use the LayoutControlItem.TextAlignMode property to enable one of the caption size options:
- AutoSize - The caption region is resized to the minimum width to display the entire text.
- CustomSize - Allows you to use the TextSize property to set a custom caption region size.
Refer to the following help article for more information: Item Label.
Use the LayoutItem.TextToControlDistance property.
enable the AutoSize (LayoutControl.AutoSize, Form.AutoSize) option and set AutoSizeMode (LayoutControl.AutoSizeMode, Form.AutoSizeMode) to GrowAndShrink for both controls - LayoutControl and it's parent container (Form).
C#public Form1() {
InitializeComponent();
layoutControl1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
layoutControl1.AutoSize = true;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
When a CheckEdit control is added to Layout Control, a new layout item is created. For the layout item that hosts a CheckEdit control, the default size constraints are calculated based on the CheckEdit control's text size.
When you change the CheckEdit control's text, the control's size changes, and the layout item's LayoutControlItem.MinSize and LayoutControlItem.MaxSize properties are updated accordingly (these properties reflect the default size constraints).
To prevent the layout item with CheckEdit from changing its size, do the following:
- Add the CheckEdit control to LayoutControl.
- Remove size constrains for the Check Edit. For example, choose Free Sizing from the context menu.
- Modify CheckEdit's text after you remove the control's size constraints.
Many images are missing. Please fix as it is hard to understand without seeing the pictures.
Hi,
I ran some tests and all inserted images are displayed correctly on my side.
Do I understand you correctly, that these images are not or cannot be displayed on your side?
If so, would you please clarify what Internet browser you are using?
Are the images displayed correctly in another browser?
Hi!
Having the same trouble - I can see five first images and cannot see the remaining three. Tested with chromium and firefox.
Anyway - I've fixed my issue even without them :)
Regards,
Jakub
Hi Jakub,
I am happy to hear that the problem has been resolved. Thank you for letting us know of your progress.
Regarding images, I was able to reproduce the behavior when GIFs aren't displayed when browsing this page incognito. I informed our web masters about this.
Please make sure that you are logged in to see all graphics.