BaseCheckEdit.AutoSizeInLayoutControl Property
Gets or sets whether the editor’s width is changed to display the editor’s content in its entirety. This property is in effect when the editor resides within a LayoutControl.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v19.1.dll
Declaration
[DXCategory("Properties")]
[Browsable(true)]
[DefaultValue(false)]
public override bool AutoSizeInLayoutControl { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | **false** | true, if auto-size mode is enabled; otherwise, false. |
Remarks
When an editor is displayed within a LayoutControl, you can use the AutoSizeInLayoutControl property to enable auto-size mode. In this instance, the editor’s width is changed to display the editor’s text in its entirety.
The layout control allows you to set size constraints for controls, specifying the range in which the control’s size can vary. See the Size Constraints topic for more information.
Example
The following code shows how to enable the auto-size feature for a CheckEdit within a LayoutControl, and center the CheckEdit within the corresponding layout item.
The auto-size feature is enabled for the CheckEdit control using its BaseCheckEdit.AutoSizeInLayoutControl
property.
In this mode, the control’s size shrinks to fit its content. This allows the control to be custom aligned within the layout item, using the LayoutControlItem.SizeConstraintsType and LayoutControlItem.ControlAlignment properties.
The image below shows the design-time result of the customization. The layout item in which the checkEdit1 control resides is highlighted in blue. The bounds of the checkEdit1 control are indicated by the rectangle at the center of the layout item:
using DevExpress.XtraLayout;
checkEdit1.AutoSizeInLayoutControl = true;
layoutControlItem2.SizeConstraintsType = SizeConstraintsType.SupportHorzAlignment;
layoutControlItem2.ControlAlignment = ContentAlignment.TopCenter;