<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;
}
}
}
}
}