Q
qiuqiu133
Unregistered / Unconfirmed
GUEST, unregistred user!
我在DBGrid中放置Combobox用于输入内容。我的代码:
procedure TFrmMain.DBGrid1DblClick(Sender: TObject);
var
Rect:TRect;
begin
if DBGrid1.SelectedIndex=7 then
begin
Rect:=TStringGrid(DBGrid1).CellRect(TStringGrid(DBGrid1).Col,TStringGrid(DBGrid1).Row) ;
if Combobox5.Parent<>DBGrid1 then
Combobox5.Parent:=DBGrid1;
Combobox5.Left:=Rect.Left;
Combobox5.Top:=Rect.Top;
Combobox5.Width:=Rect.Right-Rect.Left;
Combobox5.Height:=Rect.Bottom-Rect.Top;
Combobox5.Visible:=True;
end;
end;
现在的问题是,当我双击DBGrid时,Combobox可见,但是不能下拉Combobox的下拉框,点击无效。请问是我代码什么地方有错误?
procedure TFrmMain.DBGrid1DblClick(Sender: TObject);
var
Rect:TRect;
begin
if DBGrid1.SelectedIndex=7 then
begin
Rect:=TStringGrid(DBGrid1).CellRect(TStringGrid(DBGrid1).Col,TStringGrid(DBGrid1).Row) ;
if Combobox5.Parent<>DBGrid1 then
Combobox5.Parent:=DBGrid1;
Combobox5.Left:=Rect.Left;
Combobox5.Top:=Rect.Top;
Combobox5.Width:=Rect.Right-Rect.Left;
Combobox5.Height:=Rect.Bottom-Rect.Top;
Combobox5.Visible:=True;
end;
end;
现在的问题是,当我双击DBGrid时,Combobox可见,但是不能下拉Combobox的下拉框,点击无效。请问是我代码什么地方有错误?