不知道算不算BCB的Bug? DateTimePicker的问题
大家可以做个极其简单的试验:
Form上放三个控件:DateTimePicker, Label, Button
DateTimePicker带CheckBox, 即ShowCheckBox属性为true
写上几行代码:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if( DateTimePicker1->Checked ){
Label1->Caption = DateTimePicker1->Date;
}
else{
Label1->Caption = "没有选中";
}
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
DateTimePicker1->Checked = false; // 不要选中
}
运行程序,点击Button, 按道理应该显示"没有选中",但Label1上显示的结果居然是"2003-7-9 ..."!就是说DateTimePicker1->Checked = false;好像没有起作用,但从画面上看日期控件确实没有打勾。
谁知道这后面的原因吗?