自定义格式DateTimePicker

自定义格式DateTimePicker

本文介绍了自定义格式DateTimePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在使用C#windows form app,我有两个dateTimePicker控件。我使用customFormat在HH:mm:ss中显示控件。我想使用一个控件作为我的startTime,另一个作为我的endTime。我似乎无法弄清楚如何设置控件的最大时间和最小时间,或者如何不允许用于startTime的dateTimePicker大于用于我的endTime的dateTimePicker。示例



 //希望时间在指定范围内
//,例如09:30:00至16:00:00
DateTimePicker dtpStartTime = new DateTimePicker();
dtpStartTime.ShowUpDown = true;
dtpStartTime.Format = DateTimePickerFormat.Custom;
dtpStartTime.CustomFormat =HH:mm:ss;

//希望时间在指定范围内
// 09:30:00至16:00:00
DateTimePicker dtpEndTime = new DateTimePicker();
dtpEndTime.ShowUpDown = true;
dtpEndTime.Format = DateTimePickerFormat.Custom;
dtpEndTime.CustomFormat =HH:mm:ss;
解决方案

I''m working on C# windows form app and I have a two dateTimePicker controls. I''ve used customFormat to display the controls in "HH:mm:ss". I''d like to use one control as my startTime and the other as my endTime. I can''t seem to figure out how to set a maximum time and a minimum times for the controls or how not allow the dateTimePicker thats used for startTime to greater then the dateTimePicker thats used for my endTime. Example

// would like for time to be within a specified range
// e.g. 09:30:00 to 16:00:00
DateTimePicker dtpStartTime = new DateTimePicker();
dtpStartTime.ShowUpDown = true;
dtpStartTime.Format = DateTimePickerFormat.Custom;
dtpStartTime.CustomFormat = "HH:mm:ss";

// would like to time to be within a specified range
// e.g. 09:30:00 to 16:00:00
DateTimePicker dtpEndTime = new DateTimePicker();
dtpEndTime.ShowUpDown = true;
dtpEndTime.Format = DateTimePickerFormat.Custom;
dtpEndTime.CustomFormat = "HH:mm:ss";
解决方案


这篇关于自定义格式DateTimePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 13:40