对于Windows窗体,有很多不错的日期选择器,但我还没有找到任何时间只有采摘。.NET WinForms的时间选择器?
有什么建议吗?
编辑
我想我应该更清楚。我正在谈论一个更好看的时间选择器。我们使用商业控制套件,默认时间选择器看起来不合适,因为它非常简单。
对于Windows窗体,有很多不错的日期选择器,但我还没有找到任何时间只有采摘。.NET WinForms的时间选择器?
有什么建议吗?
编辑
我想我应该更清楚。我正在谈论一个更好看的时间选择器。我们使用商业控制套件,默认时间选择器看起来不合适,因为它非常简单。
的DatePicker有一个可以设置为时间属性的格式。 务必将ShowUpDown设置为True。
Infragistics在Winforms中非常流行,并且可以选择使用它的DateTimePicker。
...的MaskInput设置为{}时间应该 得到你正在寻找的行为。 如果仅设置FormatString 属性,则仅当控件处于编辑模式 (当光标在控件中时)时,才会显示 。
你是说,相对于标准的Winforms DateTimePicker?
this.dateTimePicker1.CustomFormat = "hh:mm tt";
this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1.ShowUpDown = true;
...
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
MessageBox.Show(dateTimePicker1.Value.TimeOfDay.ToString());
}
只是为了阐述Michael Petrotta's响应代码
this.dateTimePicker1.CustomFormat = "hh:mm";
为12小时的格式,其中如下面的代码为24小时格式
this.dateTimePicker1.CustomFormat = "HH:mm";
这是一个链接到sourceforge上的开源时间选择器:https://sourceforge.net/projects/time-picker/
就是这样
Windows窗体中的DateTimePicker可以仅使用CustomFormat属性执行时间...您只是在寻找更具性感的控件吗? – Brandon 2009-06-25 21:21:54
是的,看起来更好。 – 2009-06-25 21:23:48