问题描述
在日期时间选择器控件中,用户必须按。(句点)以移至不同的字段(如日,月年)
In datetime picker control the user has to press .(period) to move to different fields (like day, month year)
我想通过以下方式覆盖此行为:允许用户输入日期而不用输入日期。(句点)
I want to override this behaviour by allowing the user to enter date without entering .(period)
是否可以在C#winforms中以编程方式实现此目的?
Is there any to achieve this programmatically in C# winforms?
预先感谢。
推荐答案
代码不是很漂亮,但是您当然可以发送。
自动。
只需处理 ValueChanged
事件(仅在用户输入整个值时才会调用) (他当前正在编辑的日期部分),然后在事件处理程序中添加代码 SendKeys.Send(。);
。
Not very beautiful code but you could of course send the .
automatically.
Just handle the ValueChanged
event (which will only be called when the user has entered a "whole" value for date part he's currently editing) and in the event handler you add the code SendKeys.Send(".");
.
这篇关于避免按。 (句点)键可移至DateTime选择器控件中的下一个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!