75 lines
1.8 KiB
C#
75 lines
1.8 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;
|
|
|
|
namespace Lskj.MyControl
|
|
{
|
|
public partial class LabelCheckDateEx : UserControl
|
|
{
|
|
public LabelCheckDateEx()
|
|
{
|
|
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;
|
|
txtBox.CustomFormat = FormatType;
|
|
}
|
|
}
|
|
[Description("提示文本")]
|
|
public string TipMsg { get; set; }
|
|
|
|
public CheckBox GetCheckBox
|
|
{
|
|
get { return cbCheck; }
|
|
}
|
|
public string FormatType { get; set; } // 日期格式化
|
|
public DateTimePicker GetDateTimePicker { get { return txtBox; } }
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|