Windows 窗体 DatePicker 在 XP 中不起作用
此问题涉及 Windows 窗体 VB.NET 应用程序。 .NET 版本是 3.5
我有一个通过复选框启用/禁用的日期选择器控件。当用户选中该框时,将启用日期选择器并选择一个日期。但是,对于运行 Windows XP 的用户,当他们选择日期时,日历将恢复为禁用状态并显示当前日期(未选中状态)。
对于 Windows 7 用户,日期将被保留,并且日期选择器仍处于启用状态。我无法找到解决方法。
除了将用户迁移到 Windows 7 之外,我还能在代码中做些什么吗?
这是复选框的代码:
Sub CheckboxDates() Handles ckbPaid.CheckedChanged
If ckbPaid.Checked = True Then
dtPaidDate.Enabled = True
Else
dtPaidDate.Enabled = False
End If
End Sub
This issue involves a Windows Forms VB.NET application. .NET version is 3.5
I have a datepicker control that is enabled/disabled by a checkbox. When the user checks the box, the datepicker is enabled and they select a date. However, for users running Windows XP, when they select a date the calendar reverts back to disabled and showing the current date (the unchecked state).
For Windows 7 users, the date is preserved and the datepicker remains in the enabled state. I am at a loss to find a workaround for this.
Short of migrating the users to Windows 7, is there anything I can do in my code?
Here is the code for the checkbox:
Sub CheckboxDates() Handles ckbPaid.CheckedChanged
If ckbPaid.Checked = True Then
dtPaidDate.Enabled = True
Else
dtPaidDate.Enabled = False
End If
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的描述,听起来您从 DatePicker 获得点击,导致它取消选中 CheckBox。
您是否尝试过重新定位复选框,使其在显示时不在日历下方?这有什么区别吗?
如果是点击式,您可以尝试在使用 DatePicker 时重新定位 CheckBox 或禁用它(使用 DropDown 和 >特写事件。)
From what you describe, it sounds like you're getting click-through from the DatePicker causing it to uncheck the CheckBox.
Have you tried repositioning the CheckBox so that it's not under the calendar when it's displayed? Does that make a difference?
If it is click-through, you could try relocating the CheckBox or disabling it while the DatePicker is being used (using the DropDown and CloseUp events.)