<strong> //LayoutControlItem</strong>
//显示或隐藏
this.layoutControlItem1.ContentVisible = true;
//显示模式 一般、自定义
this.layoutControlItem1.TextAlignMode = TextAlignModeItem.CustomSize;
//文本显示位置 居左
this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Left;
//文本 间距
this.layoutControlItem1.TextToControlDistance = 0;
//文本 宽和高 (可以在属性中修改)
//this.layoutControlItem1.TextSize.Width = 45;
<strong> //LayoutControlGroup</strong>
//是否显示组标题
this.layoutControlGroup2.TextVisible = false;
//是否显示 展开按钮
this.layoutControlGroup3.ExpandButtonVisible = true;
//展开按钮的模式
this.layoutControlGroup3.ExpandButtonMode = DevExpress.Utils.Controls.ExpandButtonMode.Inverted;
//展开按钮显示在 标题行 尾
this.layoutControlGroup3.ExpandButtonLocation = DevExpress.Utils.GroupElementLocation.AfterText;
//是否展开
this.layoutControlGroup3.Expanded = true;
/// <summary>
/// 设置LayoutControl 下的控件不可用(只读)
/// </summary>
/// <param name="isRead">是否只读 是=true</param>
private void SetControlReadOnly(bool isRead) {
//遍历LayoutControlGroup
foreach (LayoutControlGroup group in layoutControl1.Items)
{
//遍历LayoutControlItem
foreach (BaseLayoutItem lci in group.Items) {
LayoutControlItem ctl = lci as LayoutControlItem;
//判断不为空
if (!object.Equals(null, ctl))
{
//控件类型
if (ctl.Control is BaseEdit)
{
BaseEdit be = ctl.Control as BaseEdit;
be.Properties.ReadOnly = isRead;
be.Enabled = !isRead;
}
if (ctl.Control is BaseButton) {
BaseButton btn = ctl.Control as BaseButton;
btn.Enabled = !isRead;
}
}
}
}
}