Show a custom calendar dropdown with a derived DateTimePicker class

后端 未结 2 1422
甜味超标
甜味超标 2021-01-23 09:00

My goal is to create a custom DateTimePicker class in .NET 2.0, which shows a custom calendar dropdown instead of the Windows default calendar popup.

By observing Window

2条回答
  •  暖寄归人
    2021-01-23 09:22

    Instead of sending a WM_CLOSE have you tried sending a DTM_CLOSEMONTHCAL message instead? You would send this to the HWND of the DateTimePicker itself and not the child window. According to the documentation, the DateTime_CloseMonthCal macro sends this message and it seems like what you want to do.

    I also don't think you'll need to use BeginInvoke to send it unless there's some problem with closing it in the same dispatch as a drop down notification.

    #define DTM_FIRST        0x1000
    #define DTM_CLOSEMONTHCAL (DTM_FIRST + 13)
    #define DateTime_CloseMonthCal(hdp) SNDMSG(hdp, DTM_CLOSEMONTHCAL, 0, 0)
    

提交回复
热议问题