procedure TfrmTest.dgTestDrawColumnCell(Sender: TObject... begin with dgTest do begin with Canvas do begin if dgTest.Row = MouseCoord(Rect.Left + 1, Rect.Top + 1).Y then begin Canvas.Font.Color := clRed; Canvas.Brush.Color := clYellow; end; DefaultDrawColumnCell(Rect, DataCol, Column, State); end; end;end;
因为,SCROLLBAR是标准的WINDOWS控件
begin
with dgTest do
begin
with Canvas do
begin
if dgTest.Row = MouseCoord(Rect.Left + 1, Rect.Top + 1).Y then
begin
Canvas.Font.Color := clRed;
Canvas.Brush.Color := clYellow;
end;
DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;end;