在.NET Winforms中让用户输入时间范围的好方法? [英] A good way in .NET Winforms to have user entered time frame?

查看:42
本文介绍了在.NET Winforms中让用户输入时间范围的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道使用Winforms控件让用户输入时间(小时和分钟)的好方法吗?目前,我有两次数字跌落,一次是时间起伏,另一次是分钟,然后我解析以创建时间跨度.我仅有的另一个想法是用户可以在其中输入"00:00"时间并验证输入的文本框.不过,这两种方式(从UI角度来看)似乎都有些糟糕.

Does anyone know of a good way to have a user enter an amount of time (hours and minutes) using winforms controls? At the moment I have two numeric up downs, one for time and one for minutes that I then parse to create a timespan. The only other idea I have is a text box that a user can enter a "00:00" time in, and validate the input. Both of these ways seem a bit bad (in UI terms) though.

有什么想法吗?

谢谢

推荐答案

您可以使用

You can use a MaskedTextBox. This will allow you to have an input box with a format based on the mask you choose (e.g. __:__). This would be useful in the event that a time amount may be above 24 hours (which a DateTimePicker control wouldn't allow you to enter).

这篇关于在.NET Winforms中让用户输入时间范围的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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