H
Hexi
Unregistered / Unconfirmed
GUEST, unregistred user!
1.双击DBGrid
2.选择需要PickList而不用PickList属性的Column
3.将ButtonStyle设为cbsEllipsis
4.在DBGrid的OnEditButtonClick中添加代码,
可以打开一个对话框,让用户选择。然后将值赋给字段例如:
//PickDate对话框是让用户选择日期,返回一个TDateTime类型的值
//Form1中有两个DBGrid,没个DBGrid中均有一项是TDateTime
procedure TForm1.DBGrid1EditButtonClick(Sender: TObject);
begin
if Sender=DBGrid1 then tb1.FieldByName('Fixture').asDateTime:=PickDate
else tb2.FieldByName('OpenDate').asDateTime:=PickDate;
end;
2.选择需要PickList而不用PickList属性的Column
3.将ButtonStyle设为cbsEllipsis
4.在DBGrid的OnEditButtonClick中添加代码,
可以打开一个对话框,让用户选择。然后将值赋给字段例如:
//PickDate对话框是让用户选择日期,返回一个TDateTime类型的值
//Form1中有两个DBGrid,没个DBGrid中均有一项是TDateTime
procedure TForm1.DBGrid1EditButtonClick(Sender: TObject);
begin
if Sender=DBGrid1 then tb1.FieldByName('Fixture').asDateTime:=PickDate
else tb2.FieldByName('OpenDate').asDateTime:=PickDate;
end;