/******************************
* 说明:自定义复选文本控件
* 创建人:龚宇超
* 创建日期:2017-08-07
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace Lskj.Control
{
///
/// 复选文本控件
///
public partial class LabelCheckEdit : BaseUserControl
{
public CheckEdit TextEdit { get { return this.checkEdt; } }
public LabelCheckEdit()
{
InitializeComponent();
}
///
/// 说明:设置控件显示文本
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The label text.
/// 显示Lebel文本
public override string LabelText
{
get
{
return this.checkEdt.Text;
}
set
{
this.checkEdt.Text = value;
this.Width = checkEdt.Width + PaddingLeft;
}
}
///
/// 说明:设置控件值
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
public override string EditText
{
get
{
return string.IsNullOrWhiteSpace(checkEdt.EditValue + "") ? "0" : checkEdt.EditValue.ToString().ToLower() == "true" ? "1" : "0";
}
set
{
string val = string.IsNullOrWhiteSpace(value) || "0".Equals(value) || "false".Equals(value, StringComparison.OrdinalIgnoreCase) ? "0" : "1";
this.checkEdt.EditValue = Convert.ToBoolean(Convert.ToInt32(val));
}
}
///
/// 只读文本颜色
///
/// The color of the read only label.
public override bool ReadOnly
{
get
{
return base.ReadOnly;
}
set
{
base.ReadOnly = value;
this.checkEdt.Properties.ReadOnly = value;
this.checkEdt.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor;
}
}
///
/// 必填文本颜色
///
/// The color of the required label.
public override bool Required
{
get
{
return base.Required;
}
set
{
base.Required = value;
if (value)
{
this.checkEdt.ForeColor = base.RequiredLabelForceColor;
}
}
}
///
/// 背景颜色
///
/// The color of the required label.
public override Color BackgroundColor
{
get
{
return TextEdit.Properties.Appearance.BackColor;
}
set
{
TextEdit.Properties.Appearance.BackColor = value;
}