Sólo añadir una cosilla más a lo dicho anteriormente, por si tuviera algo que ver. Este es el código que tengo en el evento
OnDrawColumnCell del
RxDBGrid.
Código:
procedure TfFacturas.RxDBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
const CtrlState : array[Boolean] of Integer = (DFCS_BUTTONCHECK,
DFCS_BUTTONCHECK or DFCS_CHECKED);
var CheckBoxRectangle : TRect;
begin
// Pintamos toda la fila de la celda booleana
// Para hacerlo tenemos que hacer referencia al campo booleano
if IBQ.AsBoolean then
begin
RxDBGrid1.Canvas.Brush.Color := clInfobk;
RxDBGrid1.Canvas.Font.Style := [fsBold];
RxDBGrid1.Canvas.Font.Color := ClBlack;
RxDBGrid1.DefaultDrawColumnCell(Rect,Datacol,Column,State);
end;
// campo Check
if Column.Field.DataType = ftBoolean then
begin
// Pintamos solo la celda booleana
if Column.Field.AsBoolean then
begin
RxDBGrid1.Canvas.Brush.Color := clInfobk;
RxDBGrid1.Canvas.Font.Style := [fsBold];
RxDBGrid1.Canvas.Font.Color := ClBlack;
RxDBGrid1.DefaultDrawColumnCell(Rect,Datacol,Column,State);
end;
RxDBGrid1.Canvas.FillRect(Rect);
CheckBoxRectangle.Left := Rect.Left + 2;
CheckBoxRectangle.Right := Rect.Right - 2;
CheckBoxRectangle.Top := Rect.Top + 2;
CheckBoxRectangle.Bottom := Rect.Bottom - 2;
DrawFrameControl(RxDBGrid1.Canvas.Handle, CheckBoxRectangle,
DFC_BUTTON, CtrlState[Column.Field.AsBoolean]);
end;
end;
mmmm....
, de donde he podido sacar este código...
Saludillos!