在NumericUpDown控件中显示“00”而不是“0” [英] Display `00` instead of `0` in a NumericUpDown control

查看:227
本文介绍了在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 NumericUpDowncontrols.

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 DateTimePickerwith 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆