求助高手在dbgrid中加入可视控件问题
源代码为:
procedure Tzccs.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if (key <> chr(9)) then
begin
if (DBGrid1.SelectedField.FieldName
=DBComboBox1.DataField) then
begin
DBComboBox1.SetFocus;
SendMessage(DBComboBox1.Handle,
WM_Char, word(Key), 0);
end;
end;
end;
procedure Tzccs.DBGrid1ColExit(Sender: TObject);
begin
If DBGrid1.SelectedField.FieldName
= DBComboBox1.DataField then
begin
DBComboBox1.Visible := false;
end;
end;
procedure Tzccs.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if (gdFocused in State) then
begin
if (Field.FieldName = DBComboBox1.DataField ) then
begin
DBComboBox1.Left := Rect.Left + DBGrid1.Left;
DBComboBox1.Top := Rect.Top + DBGrid1.top + 25;
DBComboBox1.Width := Rect.Right - Rect.Left;
DBComboBox1.Height := Rect.Bottom - Rect.Top;
DBComboBox1.Visible := True;
end;
end;
end;
在dbgrid的columns editor中使用add all fields之后,可视控件就无法出现在dbgrid中.环境为win98 delphi7.0