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 ControlLib.inh; namespace Lskj.MyControl { public partial class LabelCheckAutoSearcherEx : UserControl { public LabelCheckAutoSearcherEx() { InitializeComponent(); } private string labelText; [Description("Label值")] public string LabelText { get { return labelText; } set { labelText = value; lbMsg.Text = value; panel2.Width = lbMsg.Width + 2 ; } } private string text; [Description("文本框值")] public override string Text { get { return txtBox.Text; } set { text = value; txtBox.Text = text; } } [Description("提示文本")] public string TipMsg { get; set; } public AutoSearcher GetAutoSearcher { get { return txtBox; } } public CheckBox GetCheckBox { get { return cbCheck; } } public void SetEnabled(bool isTrue) { txtBox.Enabled = isTrue; lbMsg.Enabled = isTrue; cbCheck.Checked = true; } private void cbCheck_Click(object sender, EventArgs e) { CheckBox cb = sender as CheckBox; lbMsg.Enabled = txtBox.Enabled = cb.Checked; } private void lbMsg_Click(object sender, EventArgs e) { cbCheck.Checked = txtBox.Enabled = !cbCheck.Checked; } } }