C# DateTimePicker 翻转问题
我有 DateTimePicker 控件,具有自定义格式来显示小时/分钟以及日期(“MM/dd/yyyy HH:mm”)。我遇到的问题是,如果我使用向上/向下箭头键更改值,它们在溢出时不会正确滚动。
前1 初始值 03/23/2011 16:58 选择分钟,点击向上箭头一次:值按预期更新为 03/23/2011 16:59 第二次点击向上箭头:值更新为 03/23/2011 16:00,而不是预期的 17:00。
前2 初始值 03/23/2011 16:00 选择分钟,单击向下箭头一次:值更新为 03/23/2011 16:59,而不是预期的 15:59。
前3 初始值 03/23/2011 23:03 选择小时,单击向上箭头一次:值更新为 03/23/2011 00:03,而不是预期的 03/24/2011 00:03。
编辑:我正在做的事情出现问题的原因是我使用 DTP 来调整对象在时间轴上的位置,而默认的翻转会导致对象跳回。固定对象的顺序会加剧这种情况。如果两个分别为 16:05 和 16:59,则第二个向上箭头翻转将导致其更改为 16:00,这是无效的。
I have DateTimePicker controls with a custom format to show hours/minutes as well as the date ("MM/dd/yyyy HH:mm"). The problem I have is that if I use the up/down arrow keys to change the values they don't roll over properly when they overflow.
ex1
initial value 03/23/2011 16:58
Select minutes, hit the up arrow once: value updates to 03/23/2011 16:59 as expected
Hit up arrow a second time: value updates to 03/23/2011 16:00, not 17:00 as expected.
ex2
initial value 03/23/2011 16:00
Select minutes, hit the down arrow once: value updates to 03/23/2011 16:59, not 15:59 as expected.
ex3
initial value 03/23/2011 23:03
Select hours, hit the up arrow once: value updates to 03/23/2011 00:03, not 03/24/2011 00:03 as expected.
Edit: The reason this is problematic on what I'm doing is that I'm using the DTPs to adjust the placement of objects on a timeline, and the default rollover results in the object jumping back. This is aggravated by the order of the objects being fixed. If two are at 16:05 and 16:59, the up arrow rollover on the 2nd would result in it changing to 16:00 which is invalid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 DateTimePicker 的预期行为。
This is the expected behaviour of the DateTimePicker.