ECommonCalendarError: Failed to set calendar date or time
ECommonCalendarError: Failed to set calendar date or time
我启动了一个新的 Delphi 应用程序,我在主窗体上放置了一个 TDateTimePicker
,并添加了以下代码:
procedure TForm1.FormShow(Sender: TObject);
begin
DateTimePicker1.MaxDate:= Now - 9;
DateTimePicker1.Date:= Now - 10;
end;
当我 运行 程序并尝试使用键盘上的 UP ARROW
更改日期时,我收到此错误消息。但是,如果我将带有 MOUSE
的日期更改为最后可能的日期,我不会收到错误消息。之后我也可以使用箭头键更改日期。
我不明白哪里出了问题以及如何解决这个问题。
更新:
当出现该错误时,我发现了另一种情况:当我下拉列表并再次关闭它时,没有选择任何内容,但使用这些设置:
procedure TForm1.FormShow(Sender: TObject);
var D:TDate;
begin
D:= Date;
DateTimePicker1.Date:= D;
DateTimePicker1.MaxDate:= D;
end;
Delphi 2009 VCL 中存在错误。问题是 MaxDate property did not add time portion of 23:59:59 to the maximum range limit. Then, when one left the Time property on time different from 00:00:00 and set only the Date property the DateTime_SetSystemTime 宏的 setter 由于日期时间范围的日期时间溢出(导致该异常)而失败。
为避免这种情况,您可以重置 Time property to 00:00:00, or assign date only (keeping time portion zeroed) to the DateTime 属性。
我启动了一个新的 Delphi 应用程序,我在主窗体上放置了一个 TDateTimePicker
,并添加了以下代码:
procedure TForm1.FormShow(Sender: TObject);
begin
DateTimePicker1.MaxDate:= Now - 9;
DateTimePicker1.Date:= Now - 10;
end;
当我 运行 程序并尝试使用键盘上的 UP ARROW
更改日期时,我收到此错误消息。但是,如果我将带有 MOUSE
的日期更改为最后可能的日期,我不会收到错误消息。之后我也可以使用箭头键更改日期。
我不明白哪里出了问题以及如何解决这个问题。
更新: 当出现该错误时,我发现了另一种情况:当我下拉列表并再次关闭它时,没有选择任何内容,但使用这些设置:
procedure TForm1.FormShow(Sender: TObject);
var D:TDate;
begin
D:= Date;
DateTimePicker1.Date:= D;
DateTimePicker1.MaxDate:= D;
end;
Delphi 2009 VCL 中存在错误。问题是 MaxDate property did not add time portion of 23:59:59 to the maximum range limit. Then, when one left the Time property on time different from 00:00:00 and set only the Date property the DateTime_SetSystemTime 宏的 setter 由于日期时间范围的日期时间溢出(导致该异常)而失败。
为避免这种情况,您可以重置 Time property to 00:00:00, or assign date only (keeping time portion zeroed) to the DateTime 属性。