DBGrid.Options属性dgRowSelect=False时,通过重绘使DBGrid有选中行的效果。
DrawColumnCell事件代码如下:
 with TMyDBGrid(Sender) do
 begin
  if DataLink.ActiveRecord = Row-1 then
  begin
    Canvas.Font.Color := $00000000;
    Canvas.Brush.Color := $00C1F0FF;
  end
  else
  begin
    Canvas.Brush.Color := Color;
    Canvas.Font.Color := Font.Color;
  end;
  DefaultDrawColumnCell(Rect,DataCol,Column,State););
 end;
posted on 2011-12-22 10:41  小爪  阅读(694)  评论(0编辑  收藏  举报