StringGrid中加入下面的代码
if (Field.FieldName = cmbType.Hint) then //用Hint保存字段名
begin
with cmbType do
begin
Left := Rect.Left + dbgEasy.Left + 1;
Top := Rect.Top + dbgEasy.Top + 1;
Width := Rect.Right - Rect.Left + 2;
Height := Rect.Bottom - Rect.Top;
if dbgEasy.SelectedField.AsString <> '' then
for i := 0 to Items.Count - 1 do
if Items.Strings = dbgEasy.SelectedField.AsString then
ItemIndex := i;
Visible := True;
end;
end;