procedure TForm9.Button1Click(Sender: TObject);
var
dlg: TForm;
dp: TDatePicker;
lbl: TLabel;
btn: TBitBtn;
date: TDate;
checker: Boolean;
begin
dlg := TForm.Create(Application.MainForm);
try
dlg.BorderStyle := bsDialog;
dlg.Caption := '
TDatePicker';
dlg.FormStyle := fsStayOnTop;
dlg.Position := poOwnerFormCenter;
dlg.BorderIcons := [biSystemMenu];
lbl := TLabel.Create(dlg);
lbl.Parent := dlg;
lbl.Align := alTop;
lbl.Alignment := taCenter;
lbl.AlignWithMargins := True;
lbl.Caption := '
Choose Date';
dp := TDatePicker.Create(dlg);
dp.Parent := dlg;
dp.Align := alTop;
dp.AlignWithMargins := True;
btn := TBitBtn.Create(dlg);
btn.Parent := dlg;
btn.Align := alTop;
btn.Caption := '
Ok.';
btn.ModalResult := MrOk;
btn.Kind := bkOK;
btn.AlignWithMargins := True;
dlg.AutoSize := True;
checker := (btn.ModalResult = dlg.ShowModal);
date :=
dp.Date;
finally
btn.Free;
dp.Free;
lbl.Free;
dlg.Free;
end;
end;