关于dbgrid中一个单元格点后出现类...的按钮,我想与时间或其它控件结合怎么办啊?!怎么个使用方法?!

解决方案 »

  1.   

    看不懂你说什么。
    现抄个代码
    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;procedure TForm1.DBGrid1ColExit(Sender: TObject);
    begin
      if DBGrid1.SelectedField.FieldName = DBComboBox1.DataField then
        begin
          DBComboBox1.Visible := false;
        end;
    end;procedure TForm1.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;