在Load中,初始化
this.dateTimePicker1.Format=DateTimePickerFormat.Custom;
his.dateTimePicker1.CustomFormat=" ";
在事件里写:
private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
{
//this.dateTimePicker1.Format=DateTimePickerFormat.Long;
this.dateTimePicker1.CustomFormat=null;
}
这样就实现了,在程序初始化时dateTimePicker显示为空。
(此文转)
本文介绍了一种在程序初始化时让DateTimePicker控件显示为空的方法。通过设置dateTimePicker1的Format属性为Custom,并将CustomFormat设置为空字符串实现。在ValueChanged事件中取消这些设置以恢复正常显示。
2197

被折叠的 条评论
为什么被折叠?



