Delphi(程序人生)

Delphi Programer DoubleCat

导航

改变Dbgrid的选定色

procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;

    Field: TField; State: TGridDrawState);

    begin

      if gdSelected in state then

      SetBkColor(dbgrid1.canvas.handle,clgreen)

      else

      setbkcolor(dbgrid1.canvas.handle,clwhite);

      dbgrid1.Canvas.TextRect(rect,0,0,field.AsString);

      dbgrid1.Canvas.Textout(rect.Left,rect.Top,field.AsString);

    end;

posted on 2008-06-14 17:11  DoubleCat  阅读(195)  评论(0编辑  收藏  举报