如何将combobox植入Dbgrid中? 注意我只用Adoquery

解决方案 »

  1.   


    DBGrid指定列上显示DBComboBox设置DBGrid1的OnDrawDataCell事件如下:
    procedure TForm1.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;
          DBComboBox1.Width := Rect.Right - Rect.Left;
          DBComboBox1.Height := Rect.Bottom - Rect.Top;
          DBComboBox1.Visible := True;
        end;
      end;
    end;  
      

  2.   

    http://bbs.56kc.com/Browers.aspx?QID=2823&Page=1