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:

using DevExpress.XtraLayout;

// Center the control horizontally and vertically.
// Center the control horizontally and vertically.
layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom;
layoutControlItem1.MinSize = new Size(100, 50);
layoutControlItem1.MaxSize = new Size(0, 0);
layoutControlItem1.Control.MaximumSize = new Size(200, 20);
layoutControlItem1.Control.MinimumSize = new Size(20, 20);
layoutControlItem1.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center;
layoutControlItem1.ContentHorzAlignment = DevExpress.Utils.HorzAlignment.Center;