/******************************
* 说明:自定义带复选框下拉列表框控件
* 创建人:龚宇超
* 创建日期: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;
using Lskj.Control.Model;
using Lskj.Business.Impl;
namespace Lskj.Control
{
///
/// 带复选框下拉列表框控件
///
public partial class LabelCheckComboxEdit : BaseUserControl
{
///
/// 复选框控件
///
/// The check edit.
public CheckEdit CheckEdit { get { return ckCheck; } }
///
/// 下拉选择框控件
///
public ComboBoxEdit TextEdit { get { return labelComboxEdit1.TextEdit; } }
///
/// 自定义下拉框控件
///
/// The combox edit.
public LabelComboxEdit ComboxEdit { get { return labelComboxEdit1; } }
public LabelCheckComboxEdit()
{
InitializeComponent();
this.TextEdit.Enabled = false;
}
///
/// 说明:设置控件显示文本
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// 显示Lebel文本
public override string LabelText
{
get
{
return this.ComboxEdit.LabelText;
}
set
{
this.ComboxEdit.LabelText = value;
}
}
///
/// 控件值
///
/// The edit text.
public override string EditText
{
get
{
//return base.EditText;
return labelComboxEdit1.EditText;
}
set
{
labelComboxEdit1.EditText = value;
TextEdit.Enabled = ckCheck.Checked = !string.IsNullOrWhiteSpace(labelComboxEdit1.EditText);
}
}
///
/// 只读文本颜色
///
/// The color of the read only label.
public override bool ReadOnly
{
get
{
return base.ReadOnly;
}
set
{
base.ReadOnly = value;
this.labelComboxEdit1.ReadOnly = value;
}
}
///
/// 必填文本颜色
///
/// The color of the required label.
public override bool Required
{
get
{
return base.Required;
}
set
{
base.Required = value;
if (value)
{
this.labelComboxEdit1.Label.ForeColor = base.RequiredLabelForceColor;
}
}
}
///
/// 说明:需要单独验证是否修改
/// 创建人:龚宇超
/// 创建日期:2017-11-08
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// true if this instance is update; otherwise, false.
public override bool IsUpdate()
{
if (this.Model.FieldType == ControlType.LabCheckComboxValue)
{
return !this.Model.Text.Equals(this.ComboxEdit.EditValue, StringComparison.OrdinalIgnoreCase);
}
else
{
return base.IsUpdate();
}
}
///
/// 说明:选中改变状态
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The source of the event.
/// The instance containing the event data.
private void ckCheck_CheckedChanged(object sender, EventArgs e)
{
try
{
CheckEdit check = sender as CheckEdit;
TextEdit.Enabled = check.Checked;
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
}
}