日期时间选择器在winform如何选择时间? [英] DateTime Picker In WinForm How To Pick Time?

查看:1552
本文介绍了日期时间选择器在winform如何选择时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
的DateTimePicker:挑选日期和时间

我M使用的WinForm日期时间选择器,它选择日期的出色的工作,但我不知道该怎么办倍。它看起来像一个时间与价值相关联,因此也许有以此来选择一个时间的方法吗?

I'm using a WinForm DateTime picker and it does a fantastic job of choosing dates, but I don't know how to do times. It looks like a time is associated with the value, so maybe there's a way to use this to pick a time?

如果没有在办法做到这一点没有内置,我就创造了时间的另一个框,然后从日期时间选择器修改日期时间值。

If there is no built in way to do this, I'll just create another box for the time and modify the DateTime value from the DateTime picker.

谢谢!

推荐答案

您可以使用内置的日期时间选择器通过添加自定义格式字符串如下:

You can use the built in DateTime picker by adding a custom format string as follows:

DateTimePicker.ShowUpDown = true;
DateTimePicker.CustomFormat = "hh:mm";
DateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;



享受!

Enjoy!

这篇关于日期时间选择器在winform如何选择时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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