C#打开日历中的DateTimePicker [英] DateTimePicker in C# open calendar

查看:310
本文介绍了C#打开日历中的DateTimePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上有一个日期时间选择器控件,我想要的是,当用户单击该日期时间选择器的文本字段时,日历应该打开.

这可能吗?如果是这样,我该怎么做?

谢谢.

它是WinForm.

Hi guys I have a date time picker control on my form, and what i want is that when the user clicks on the text field of that date time picker the calendar should open.

Is this possible? If so, how can i accomplish this?

Thanks.

Its a WinForm.

推荐答案

检查本文

对多个TextBox控件使用一个DateTimePicker [
Check this article

Using one DateTimePicker for multiple TextBox controls[^]


例如,首先加载表单(或在构造函数中) GotFocus事件
First on form load (or in constructor) wire for example GotFocus event
dateTimePicker1.GotFocus += new EventHandler(dateTimePicker1_GotFocus);



然后在处理程序中



And then in the handler

void dateTimePicker1_GotFocus(object sender, EventArgs e) {
   System.Windows.Forms.SendKeys.Send("%{DOWN}");
}


是的,可以使用AJAX Control Toolkit.请参阅本文以进行实施:

ASP.NET 2.0和AJAX控制工具包中的DatePicker [ DateTimePicker Web控件 [
Yes, it is possible using AJAX Control Toolkit. refer this article for implementation:

DatePicker in ASP.NET 2.0 and AJAX Control Toolkit[^]

Or you can use this :

DateTimePicker Web Control[^]
hope it helps :)


这篇关于C#打开日历中的DateTimePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆