c# - 日期时间选择器 Winforms : Move focus left arrow key

标签 c# .net winforms datetimepicker

我正在制作一个“键盘操作的应用程序”,用户将只使用键盘。 用户将使用左右箭头键,有时使用向上和向下箭头键在填写表单时浏览不同的控件。为此,我使用 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})).

请提出解决方案。

最佳答案

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

关于c# - 日期时间选择器 Winforms : Move focus left arrow key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6108612/

相关文章:

.net - tableLayoutPanel 列宽

c# - Google Oauth 2.0 redirect_uri_mismatch - 端口在回调时更改

c# - Serverless API Gateway/Lambda 下载 PDF 失败

c# - MySql.Data.MySqlClient.MySqlException : 'There is already an open DataReader associated with this Connection which must be closed first.'

c# - 如何对 GridView 进行排序?

.net - WPF - 在 SYSTEM 帐户下执行进程时性能低下

c# - 作为 Entity Framework 生成代码的结果的命名空间

c# - 限制文本框中的数字和字母 - C#

c# - Windows 窗体 C# 项目中的嵌入式 WebBrowser

c# - 等于覆盖和 == 重载,对于值对象与实体