如何限制DateTimePicker
只选择时间?我不知道当你按下右边的按钮时,如何禁用日历控制DateTimePicker
.
Pet*_*ter 127
MSDN的一个片段:
'以下代码示例显示了如何创建一个DateTimePicker,使用户只能选择一个时间.
timePicker = new DateTimePicker();
timePicker.Format = DateTimePickerFormat.Time;
timePicker.ShowUpDown = true;
Run Code Online (Sandbox Code Playgroud)
Sve*_*son 39
...或者如果您只想显示时间值的一部分,请使用"自定义":
timePicker = new DateTimePicker();
timePicker.Format = DateTimePickerFormat.Custom;
timePicker.CustomFormat = "HH:mm"; // Only use hours and minutes
timePicker.ShowUpDown = true;
Run Code Online (Sandbox Code Playgroud)
See*_*arp 13
您想将其"格式"属性设置为时间并向其添加旋转按钮控件:
yourDateTimeControl.Format = DateTimePickerFormat.Time;
yourDateTimeControl.ShowUpDown = true;
Run Code Online (Sandbox Code Playgroud)