在NumericUpDown控件中显示“00”而不是“0” [英] Display `00` instead of `0` in a NumericUpDown control
本文介绍了在NumericUpDown控件中显示“00”而不是“0”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NumericUpDown
控件来选择计划任务的日期/时间。 我希望使用前导0填充一位数值,以便显示 09:00
而不是 9:0
。
解决方案
最终的解决方案是使用 DateTimePicker
与 ShowUpDown
设置为 True
和格式
设置为时间
或自定义
。在后一种情况下,您可以使用 hh:mm
或 HH:mm
作为自定义格式。
I'm letting users select a date/time for a scheduled task to run, using two NumericUpDown
controls.
I'd like one-digit values to be padded with a leading 0, so as to display 09:00
instead of 9:0
.
解决方案
The definitive solution is to use a DateTimePicker
with ShowUpDown
set to True
and Format
set to Time
or Custom
. In the latter case, you'd use hh:mm
or HH:mm
as a custom format.
这篇关于在NumericUpDown控件中显示“00”而不是“0”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文