home *** CD-ROM | disk | FTP | other *** search
- unit dt;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ComCtrls, ToolWin, Grids, Calendar, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Calendar1: TCalendar;
- DateTimePicker1: TDateTimePicker;
- procedure DateTimePicker1Change(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Calendar1Change(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.DateTimePicker1Change(Sender: TObject);
- var
- Year, Month, Day : Word;
- begin
- DecodeDate(DateTimePicker1.Date, Year, Month, Day);
- Calendar1.Month := Month;
- Calendar1.Day := Day;
- end;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- DateTimePicker1.Align := alTop;
- Calendar1.Align := alClient;
- end;
-
- procedure TForm1.Calendar1Change(Sender: TObject);
- var
- Year, Month, Day : Word;
- begin
- DecodeDate(DateTimePicker1.Date, Year, Month, Day);
- DateTimePicker1.Date := EncodeDate(Year, Month, Calendar1.Day);
- end;
-
- end.
-