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.MyControl { public partial class LabelCheckBox : UserControl { public LabelCheckBox() { InitializeComponent(); } private string labelText; [Description("Label值")] public string LabelText { get { return labelText; } set { labelText = value; checkEdt.Text = value; this.Width = checkEdt.Width + 5; } } private string checkValue; public override string Text { get { //MessageBox.Show(Convert.ToInt32(checkEdt.EditValue).ToString()); return (checkEdt.EditValue+""=="") ? "0" : Convert.ToInt32( checkEdt.EditValue).ToString();} set { if (string.IsNullOrEmpty(value)) checkValue = "0"; else checkValue = value; this.checkEdt.EditValue = Convert.ToBoolean(Convert.ToInt32(checkValue)); } } public CheckEdit GetCheckBox { get { return checkEdt; } } } }