使DateTimePicker在按键上可编辑 [英] Make DateTimePicker Editable on keypress

查看:114
本文介绍了使DateTimePicker在按键上可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是VB.NET的新生.我知道DateTimePicker(DTP)可以在按键(UP/DOWN键)上进行编辑.太完美了.

现在我使用自定义格式的DTP(hh:mm tt-12:00 AM).我想通过keypress(字符keypress)使DTP可编辑.我可以分别将焦点放在hh或mm或tt上,并使用UP/DOWN键进行编辑,但是如果我按任何数字键(0-9)都无法正常工作.我想这没有实现.

我尝试自己实施,但是被卡住了.

1)如何知道我当前的焦点在哪里,是否是hh mm tt?
2)并且如果我能够知道焦点,如何将新值更新为DTP对象?

是否有任何专家愿意帮忙或向我建议其他可以从中获得更多信息的站点?

预先感谢,
Skunkhead.

Hi guys,

I''m a freshie to VB.NET. I know that DateTimePicker(DTP) can be edited on keypress(UP/DOWN Key). This is perfect.

Now im using DTP with custom format(hh:mm tt - 12:00AM). I would like to make the DTP editable through keypress(character keypress). I''m able to set focus on hh or mm or tt separately and use the UP/DOWN key to edit but it is not working if I press on any numeric keys(0-9). I guess there is no implementation for this.

I tried to implement one myself but I got stucked in.

1) how to know where is my current focus, whether its hh mm tt?
2) and if i''m able to know the focus, how to update the new value to the DTP object?

Are there any experts on this would like to give a hand or suggest me any other sites where I can get more information about this?

Thanks in advance,
Skunkhead.

推荐答案

首先将DTP格式设置为custom.
然后设置自定义格式hh:mm:tt




默认情况下,DTP不提供使用向上/向下更改键的功能.
为了执行此操作,您需要创建一个自定义控件,其中具有三个数字向上按钮,用于显示hh mm和tt的值.

如果用户按f2,则自定义"控件将可见.并将自定义"控件的位置设置为"DTP位置".
First Set DTP Format to custom.
Then set custom format hh:mm:tt

or


By Default DTP not provide the facility to change with Key Up/Down.
for Performing this operation you should need to create a Custom Control in which have three numericupdown button which shows the value of hh mm and tt.

The Custom control will be visible if user press f2. and Set the location of Custom control to DTP Location.


^ ]可能会指导您.
this[^] may guide you.


这篇关于使DateTimePicker在按键上可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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