当我单击Windows中的按钮时,如何在日期时间选择器中弹出日历 [英] how can i pop up calender in date time picker when i click a button in Windows

查看:364
本文介绍了当我单击Windows中的按钮时,如何在日期时间选择器中弹出日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击Windows中的按钮时,如何在日期时间选择器中弹出日历.
我想通过单击按钮或选择单选按钮在dtp中弹出日历

解决方案

您处理按钮单击,并显示其中包含日期选择器的表单. /blockquote>

http://social.msdn.microsoft.com/Forums/zh-CN/vbgeneral/thread/05bc5867-9c54-4cc4-99f1-7c91abacc6aa [ [System.Runtime.InteropServices.DllImport(" )] 私有 静态 外部 IntPtr hWnd,// 到达目标窗口的句柄 Int32 消息,// 消息 Int32 wParam,// 第一个消息参数 Int32 lParam // 第二个消息参数 ); const Int32 WM_LBUTTONDOWN = 0x0201; 私有 无效 myOpenDTPButton_Click(对象发​​件人,EventArgs e) { Int32 x = myDateTimePicker.Width- 10 ; Int32 y = myDateTimePicker.Height/ 2 ; Int32 lParam = x + y * 0x00010000; PostMessage(myDateTimePicker.Handle,WM_LBUTTONDOWN, 1 ,lParam); }


how can i pop up calender in date time picker when i click a button in Windows.
i want pop calendar in dtp by click a button or select radio button

You handle your button click and you show a form that has a date picker in it.


http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/05bc5867-9c54-4cc4-99f1-7c91abacc6aa[^]

refer this link


As far as I know, the only way to do it is to simulate a mouse click:

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool PostMessage(
IntPtr hWnd, // handle to destination window
Int32 msg, // message
Int32 wParam, // first message parameter
Int32 lParam // second message parameter
);

const Int32 WM_LBUTTONDOWN = 0x0201;

private void myOpenDTPButton_Click(object sender, EventArgs e)
    {
    Int32 x = myDateTimePicker.Width - 10;
    Int32 y = myDateTimePicker.Height / 2;
    Int32 lParam = x + y * 0x00010000;

    PostMessage(myDateTimePicker.Handle, WM_LBUTTONDOWN, 1, lParam);

    }


这篇关于当我单击Windows中的按钮时,如何在日期时间选择器中弹出日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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