1. Technology

How to Remove the "Today" Mark from the TDateTimePicker

By

The TDateTimePicker component displays a list box for entering dates or times. By design it displays the label "today" at the bottom of the control allowing a user to quickly select the today's date.

Here's how to remove the "today" marker from the TDateTimePicker. Handle the OnDropDown event as:

 uses CommCtrl, ...
 
 procedure TForm1.DateTimePicker1DropDown(Sender: TObject) ;
 var
    wnd: HWND;
    style: Integer;
 begin
    wnd := DateTime_GetMonthCal(DateTimePicker1.Handle) ;
    if wnd <> 0 then
    begin
      style := GetWindowLong(wnd, GWL_STYLE) ;
      SetWindowLong(wnd, GWL_STYLE, style or MCS_NOTODAY or MCS_NOTODAYCIRCLE) ;
    end;
 end;
 
Note: Here's how to show week numbers in a TDateTimePicker.

Delphi tips navigator:
» How to Detect a TPopupMenu's OnClose (OnPopDown) Event
« How to Clone a Delphi Form

©2014 About.com. All rights reserved.