在DateTimePicker中的数据输入上移至后续日期部分 [英] Move to Following Date Part on Data Entry in DateTimePicker

查看:63
本文介绍了在DateTimePicker中的数据输入上移至后续日期部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要满足的用户请求,我想解释的最简单的方法是使用带图片的插图:





MM [反斜杠(或向右箭头)]

DD [反斜杠]

YYYY [反斜杠]等...



他们想输入值并移至下一个日期部分值。虽然这看起来并不多,但我可以想象它会增加额外的击键次数,并使最终用户脱离数字键盘。我当前正在使用具有自定义格式的Telerik的Winform RadDateTimePicker:

  MM / dd / yyyy hh:mm tt 

,但不反对将其更改为Winforms DateTimePicker。



有人可以为此提出一个优雅的解决方案吗?我目前唯一能想到的就是在控件处于焦点时捕获击键,但是我感觉这很麻烦。



谢谢

解决方案


  1. RadMaskedEditBox(以及分别在内部使用RadMaskedEditBox的RadDateTimeEditor)具有内置功能来选择下一部分,但是,此面罩似乎无法正常工作,因此我将其报告为问题。这是它的链接:问题链接。您可以订阅状态更改警报,以便在完成后获得通知。


  2. 您可以看到的是自由格式日期时间解析。它允许您输入 10162014,它将被解析为 10\16\2014。有关更多信息,请参见以下解析日期:解析日期


  3. 最后一件事是使用KeyDown并手动移动选择。提供程序上有用于此的API。以下是访问它的方法:

     (this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider为MaskDateTimeProvider)。SelectNextEditableItem(); 


我希望其中一些对您有用。


I have a user request that I'm trying to accommodate, the simplest way I can think to explain is to use illustrate with a picture:

Essentially the user is typing a ton of dates in. Instead of typing the

MM [Backslash (Or Right Arrow)]
DD [Backslash]
YYYY [Backslash] etc ...

They'd like to Key the value and be moved to the next Date Part Value. While this doesn't seem like much I can imagine it adds up to allot of additional keystrokes and takes the end user off the number pad. I'm currently using Telerik's Winform RadDateTimePicker with Custom Format:

MM/dd/yyyy hh:mm tt

but would not be opposed to changing to the Winforms DateTimePicker.

Can anyone suggest an elegant solution for this ? The only thing I can currently think of is catching the keystrokes when the control is in focus but I feel like this could be messy.

Thankyou

解决方案

  1. RadMaskedEditBox (and respectively RadDateTimeEditor, which uses RadMaskedEditBox internally), have build in functionality to select the next part, however, it seems it does not work correctly with this mask, so I reported it as an issue. Here is the link to it: issue link. You can subscribe for status change alerts in order to get notified once its done.

  2. What you can look at is the free form date time parsing introduced recently. It allows you to type in "10162014" which will get parsed to "10\16\2014". More information no parsing dates is available here: Parsing Dates

  3. And the last thing would be to work with KeyDown and manually move the selection. There is API for this on the provider. Here is how to access it:

    (this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider as MaskDateTimeProvider).SelectNextEditableItem();
    

I hope some of this works for you.

这篇关于在DateTimePicker中的数据输入上移至后续日期部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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