开发者

Best aproach for working with Time in WinForms?

I'm trying to make a field where user will enter amount of time per day he/she spent o开发者_运维知识库n a project per day. It can be from 30 minutes to 8 hours. Is DateTimePicker with CustomFormat hh:mm best choice for this? Or there's better alternative for WinForms C#? Maybe TextBox or MaskedTextBox with special settings?


If you're comfortable with it, I would build a custom control for this. Maybe a read only textbox where I display the formatted time spent, and 2 buttons, one for up, one for down that looked something like the old VB updown control. I'd suggest adding a minimum, maximum, and up / down interval properties also. This should be an easy enough control to do and it would go a long way towards simplifying the user input.


Although the MaskedTextBox is generally a pain, this is a situation it could be useful. With Mask="00:00". Give it a spin.

And you will have to convert to/from text to TimeSpan yourself


How about a textfield with the format "7h 30m" (7 hours and 30 minutes)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜