如何使用NumericUpdown Control以12小时格式选择时间.. [英] how to use NumericUpdown Control to select time in 12 hrs format..
本文介绍了如何使用NumericUpdown Control以12小时格式选择时间..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我必须在一个应用程序中,我已经安排在每周的特定时间选定的一天,为此我我正在为用户制作一个窗口表格,他们可以在其中选择日期和时间..
为此我使用的是数字下载控件但是对于如何使用它没有任何想法。 。
Hi Friends,
I have to m,ake an app in which i have schedule it for the selected day on particular time in every week, for this i am making a windows form for the user in which they can select the day and time of day..
For this i am using numericupdown control but dont have any idea for how to use it for time...
推荐答案
NumericUpDown控件对此可能是一个不好的选择,除非你只是试图在1到12之间选择一个小时,在这种情况下它是''琐碎的 - 所以我怀疑你想要更复杂的东西,比如AM / PM或小时和分钟等等。
如果是这样,为什么不是使用DateTimePicker而是?它允许您指定格式为时间,并禁用日历按钮以显示向上/向下按钮。
只需在设计器中设置属性:
A NumericUpDown control is probably a poor choice for this, unless you are just trying to pick an hour between 1 and 12 inclusive, in which case it''s trivial - so I suspect that you want something more complicated, such as AM / PM or hour and minutes, and so forth.
If that is the case, why not use a DateTimePicker instead? It allows you to specify the Format as Time, and disable the calendar button to show an up / down button instead.
Just set the properties in teh designer:
Format Time
ShowUpDown true
或
or
Format Custom
CustomFormat hh:mm
ShowUpDown true
如果你对秒钟不感兴趣。
If you aren''t interested in seconds.
这篇关于如何使用NumericUpdown Control以12小时格式选择时间..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文