* 日期、时间选择框增加CanEmpty,输入可为空
This commit is contained in:
parent
94a441c9f7
commit
f007912101
Binary file not shown.
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
3
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
3
SunnyUI.Demo/Controls/FCombobox.Designer.cs
generated
@ -127,6 +127,7 @@
|
||||
//
|
||||
// uiDatetimePicker1
|
||||
//
|
||||
this.uiDatetimePicker1.CanEmpty = true;
|
||||
this.uiDatetimePicker1.FillColor = System.Drawing.Color.White;
|
||||
this.uiDatetimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiDatetimePicker1.Location = new System.Drawing.Point(388, 136);
|
||||
@ -184,6 +185,7 @@
|
||||
//
|
||||
// uiTimePicker1
|
||||
//
|
||||
this.uiTimePicker1.CanEmpty = true;
|
||||
this.uiTimePicker1.FillColor = System.Drawing.Color.White;
|
||||
this.uiTimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTimePicker1.Location = new System.Drawing.Point(188, 136);
|
||||
@ -225,6 +227,7 @@
|
||||
//
|
||||
// uiDatePicker1
|
||||
//
|
||||
this.uiDatePicker1.CanEmpty = true;
|
||||
this.uiDatePicker1.FillColor = System.Drawing.Color.White;
|
||||
this.uiDatePicker1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiDatePicker1.Location = new System.Drawing.Point(30, 136);
|
||||
|
@ -83,6 +83,7 @@ namespace Sunny.UI
|
||||
protected override void ItemForm_ValueChanged(object sender, object value)
|
||||
{
|
||||
SelectedIndex = ListBox.SelectedIndex;
|
||||
Box_SelectedIndexChanged(null, null);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@ namespace Sunny.UI
|
||||
TextChanged += UIDatePicker_TextChanged;
|
||||
}
|
||||
|
||||
[DefaultValue(false)]
|
||||
[Description("日期输入时,是否可空显示"), Category("SunnyUI")]
|
||||
public bool CanEmpty { get; set; }
|
||||
|
||||
private void UIDatePicker_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Text.Length == MaxLength)
|
||||
@ -59,6 +63,11 @@ namespace Sunny.UI
|
||||
|
||||
private void UIDatePicker_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (Text.IsNullOrEmpty())
|
||||
{
|
||||
if (CanEmpty) return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DateTime dt = Text.ToDateTime(DateFormat);
|
||||
|
@ -48,6 +48,10 @@ namespace Sunny.UI
|
||||
|
||||
}
|
||||
|
||||
[DefaultValue(false)]
|
||||
[Description("日期输入时,是否可空显示"), Category("SunnyUI")]
|
||||
public bool CanEmpty { get; set; }
|
||||
|
||||
public UIDatetimePicker()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -77,6 +81,11 @@ namespace Sunny.UI
|
||||
|
||||
private void UIDatePicker_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (Text.IsNullOrEmpty())
|
||||
{
|
||||
if (CanEmpty) return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DateTime dt = Text.ToDateTime(DateFormat);
|
||||
|
@ -56,6 +56,10 @@ namespace Sunny.UI
|
||||
MaxLength = 8;
|
||||
}
|
||||
|
||||
[DefaultValue(false)]
|
||||
[Description("日期输入时,是否可空显示"), Category("SunnyUI")]
|
||||
public bool CanEmpty { get; set; }
|
||||
|
||||
private void UIDatePicker_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Text.Length == MaxLength)
|
||||
@ -74,6 +78,11 @@ namespace Sunny.UI
|
||||
|
||||
private void UIDatePicker_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (Text.IsNullOrEmpty())
|
||||
{
|
||||
if (CanEmpty) return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DateTime dt = (DateTime.Now.DateString() + " " + Text).ToDateTime(DateTimeEx.DateFormat + " " + timeFormat);
|
||||
|
Loading…
x
Reference in New Issue
Block a user