You have to use interop to to send request to windows that show DataTimePicker
on click of the button
using System.Runtime.InteropServices;
[DllImport( "user32.dll" )]
private static extern bool PostMessageForCalender(
IntPtr hWnd,
Int32 msg,
Int32 wParam,
Int32 lParam
);
const Int32 WM_LBUTTONDOWN = 0x0201;
private void button1_Click( object sender, EventArgs e)
{
Int32 x = dateTimePicker1.Width - 10;
Int32 y = dateTimePicker1.Height / 2;
Int32 lParam = x + y * 0x00010000;
PostMessageForCalender(dateTimePicker1.Handle, WM_LBUTTONDOWN, 1,lParam);
}
|