【问题标题】:DateTimePicker Winforms: Move focus left arrow keyDateTimePicker Winforms:向左箭头键移动焦点
【发布时间】:2011-05-24 18:45:52
【问题描述】:

我正在制作一个“键盘操作的应用程序”,其中用户将只使用键盘。 用户将使用左右箭头键,有时向上和向下箭头键在填写表单时浏览不同的控件。为此,我使用 keydown 事件并使用 SendKeys.SendWait({TAB}) 作为右键和 SendKeys.SendWait (+{TAB}) 左键。

我有一个自定义格式为 dd/MM/yyyy 的 DateTimePicker。

When the year part is selected and the user presses the left arrow key, the focus moves to month part.当再次按下箭头键时,焦点将移至日部分。

What I want is that when the day part is selected and the user presses the left arrow key, focus should move to the previous control (SendKeys.SendWait(+{TAB})).

请提出解决方案。

【问题讨论】:

标签: c# .net winforms datetimepicker


【解决方案1】:

编辑:不幸的是,标准的 DateTimePicker 没有公开任何方式来判断选择了哪个元素,因此如果不创建自己的控件就不可能实现这一点。

【讨论】:

  • 我希望只有当日期部分被选中并且用户按下左键时焦点才会移动。另外你的代码不是通用的,我将不得不为每个控件编写一个单独的事件处理程序: (
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-27
  • 1970-01-01
  • 2020-02-20
相关资源
最近更新 更多