Back to Devexpress

SimpleButton.AutoWidthInLayoutControl Property

windowsforms-devexpress-dot-xtraeditors-dot-simplebutton-25fca13f.md

latest3.2 KB
Original Source

SimpleButton.AutoWidthInLayoutControl Property

Gets or sets whether the control’s width is changed to display the control’s content in its entirety. This property is in effect when the control resides within a LayoutControl.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(false)]
[DXCategory("Properties")]
public bool AutoWidthInLayoutControl { get; set; }
vb
<DXCategory("Properties")>
<DefaultValue(False)>
Public Property AutoWidthInLayoutControl As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if auto-size mode is enabled; otherwise, false.

|

Remarks

When a control is displayed within a LayoutControl, you can use the AutoWidthInLayoutControl property to enable the auto-width feature. In this instance, the control’s width is changed to display the control’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 and Alignment topic, for more information.

Example

The following code shows how to enable the auto-width feature for a SimpleButton within a LayoutControl and center this button within the corresponding layout item:

csharp
using DevExpress.XtraLayout;

simpleButton1.AutoWidthInLayoutControl = true;
layoutControlItem1.SizeConstraintsType = SizeConstraintsType.SupportHorzAlignment;
layoutControlItem1.ContentHorzAlignment = DevExpress.Utils.HorzAlignment.Center;
vb
Imports DevExpress.XtraLayout

SimpleButton1.AutoWidthInLayoutControl = True
LayoutControlItem1.SizeConstraintsType = SizeConstraintsType.SupportHorzAlignment
LayoutControlItem1.ContentHorzAlignment = DevExpress.Utils.HorzAlignment.Center

See the following help topic for more information: Size and Alignment.

See Also

Size and Alignment

SimpleButton Class

SimpleButton Members

DevExpress.XtraEditors Namespace