的DateTimePicker:挑选日期和时间 [英] DateTimePicker: pick both date and time

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

问题描述

是否有可能使用的DateTimePicker(的WinForms)挑选日期和时间(在下拉列表)?如何改变拾取值的自定义显示?此外,是否有可能使用户能够手动键入日期/时间?

Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?

推荐答案

格式设置为自定义,然后指定的格式为:

Set the Format to Custom and then specify the format:

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM dd yyyy hh mm ss";  

不过还是要打好它。然后,您可以键入直接的日期/时间。如果你使用MMM,你需要使用数字值月入境,除非你写的一些$ C C $自己为(例如,5导致日)

or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use the numeric value for the month for entry, unless you write some code yourself for that (e.g., 5 results in May)

不知道该选择器的日期和时间在一起。听起来像一个自定义的控制了我。

Don't know about the picker for date and time together. Sounds like a custom control to me.

这篇关于的DateTimePicker:挑选日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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