Uses commctrl;
Var OldwindowProc: Twndmethod;
procedure TForm1.MyWindowProc (var Msg: TMessage); begin if Msg.Msg = CN_NOTIFY then begin case TWMNotify (msg) .NMHdr.code of MCN_GETDAYSTATE: Memo1.Lines.Add ( 'MCN_GETDAYSTATE'); // turning point MCN_SELECT , MCN_SELCHANGE: MEMO1.LINES.ADD ('MCN_SELECT, MCN_SELCHANGE'); // Select the date end; end;
OldwindowProc (MSG);
Procedure tForm1.form; begin oldwindowproc: = monthcalendar1.windowproc; monthcalendar1.windowproc: = myWindowProc;
549 problem, after eating, I have seen the source code of VCL, it should be! However, point the page button will also trigger the date of the date, the opposite is not!
Also see one:
Publish TDATETIMEPICKER simultaneously modify date and time solution
Type tcdatetimepicker = class (tdatetimepicker) private procedure: twmnotify; message cn_notify;
Function IsblankSystime (const st: tsystemtime): boolean; type tfast = array [0..3] of dword; begin result: = (tfast (st) [0] or tfast (st) [1] or tfast (ST) [ 2] OR TFAST (ST) [3]) = 0;
procedure TCDateTimePicker.CNNotify (var Message: TWMNotify); begin with Message, NMHdr ^ do begin Result: = 0; if (code = DTN_DATETIMECHANGE) and (PNMDateTimeChange (NMHdr) ^ dwFlags = GDT_VALID.) and (not DroppedDown) and (not (ShowCheckBox and isblanksystime)))) The DateTime: = SystemTimetodateTime (PnmdateTimeChange (nmHDR) ^. St); end; inherited;
Procedure tForm1.Button1Click (Sender: Tobject); Begin with tcdatetimePicker.create (self) DO BEGIN LEFT: = 100; Top: = 100; Parent: = Self; Format: = 'YYYY-MM-DD HH: mm: ss' Visible: = true; end;
You can directly modify it by pressing the down button, not bad! But to change to the pull panel, there is time to choose, it may be difficult!