//不知道从那位的道的了。解决问题就行了。 procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin checkbox1.SetBounds(rect.Left+dbgrid1.Left+1,rect.Top+dbgrid1.Top+1,rect.Right-rect.Left,rect.Bottom-rect.Top); end; ===================== 您可以根据需要改变一下checkbox的位置.比如判断一下是否是第一列: if if (gdFocused in state) and (column.FieldName='LAST_NAME') THEN begin checkbox1.setbounds... end
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
checkbox1.SetBounds(rect.Left+dbgrid1.Left+1,rect.Top+dbgrid1.Top+1,rect.Right-rect.Left,rect.Bottom-rect.Top);
end;
=====================
您可以根据需要改变一下checkbox的位置.比如判断一下是否是第一列:
if if (gdFocused in state) and (column.FieldName='LAST_NAME') THEN
begin
checkbox1.setbounds...
end