91 lines
2.2 KiB
C#
91 lines
2.2 KiB
C#
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 CommonLib;
|
|
|
|
namespace Lskj.MyControl
|
|
{
|
|
public partial class LabelCheckComboxEx : UserControl
|
|
{
|
|
public LabelCheckComboxEx()
|
|
{
|
|
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 ComboBox getComboBox { get { return txtBox; } }
|
|
|
|
|
|
|
|
public void setDataSource(string sql, string key, string value)
|
|
{
|
|
if (!string.IsNullOrEmpty(sql))
|
|
{
|
|
DataTable dt = SqlHelper.ExecuteDataSet(sql).Tables[0];
|
|
txtBox.DataSource = dt;
|
|
txtBox.DisplayMember = value;
|
|
txtBox.ValueMember = key;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
}
|
|
}
|