Skip to main content
A newer version of this page is available. .

How to: Custom align a control within its layout item

The following code shows how to align a ButtonEdit control horizontally and vertically within a layout item:

AlignControlHorizontallyAndVertically

using DevExpress.XtraLayout;

// Center the control horizontally and vertically.
layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom;
layoutControlItem1.ControlMaxSize = new Size(0, 100);
layoutControlItem1.ControlMinSize = new Size(100, 50);
layoutControlItem1.FillControlToClientArea = false;
layoutControlItem1.Control.MaximumSize = new Size(200, 20);
layoutControlItem1.ControlAlignment = ContentAlignment.MiddleCenter;