When you have a TDBGrid, full row selection and always show the selection, even if it is not focused, and you want to use it completely, you have the selection of the outdated event OnDrawDataCell, and the new event DrawColumnCell, I selected the latter and try the following:
procedure TDbGridTestForm.mygridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdSelected in State then begin
// mygrid.DrawCellHighlight(Rect, State, Col, Row);
mygrid.Canvas.Brush.Color := clHighlight;
mygrid.Canvas.Font.Color := clHighlightText;
mygrid.Canvas.FillRect(Rect);
end;
mygrid.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
And what drives me crazy is that the focus indicator (highlight color and focus rectangle) is not drawn with the DefaultDrawColumnCell code, and I'm sure I should call DrawCellHighlight instead of doing the FillRect hack that I do above ,
DefaultDrawing, ( ), , ( gdSelected).
DBGrids.pas DefaultDrawColumnCell , . , , . , Grids.pas, DBGrids.pas, . , DrawCellHighlight ( ) Col Row, TCustomGrid.DrawCellHighlight, .
, , . NOte, DefaultDrawing , , , , . TCustomGrid.DrawCellHighlight( , ), .