neon_ni:这个要用owner_draw
以前有很多相关的问题。我都回答了不少。
你去搜乙下!

解决方案 »

  1.   

    procedure TNewChildForm15.ExtStringGrid1DrawCell(Sender: TObject; ACol,
      ARow: Integer; Rect: TRect; State: TGridDrawState);
    begin
    if Acol=0 then
    StringGrid1.Canvas.Font.Color := clblack
      else
    StringGrid1.Canvas.Font.Color := clgreen;
    end;可是不行
      

  2.   

    另外 还需要cells里的内容 左右居中,还有上下居中,加上按条件变换某行的背景颜色,谁能给出drawcell 的代码啊,谢谢了,小弟急急急!
      

  3.   

    procedure Tfrmdeparttable.StringGrid1DrawCell(Sender: TObject; ACol,
      ARow: Integer; Rect: TRect; State: TGridDrawState);
    begin
         if arow=0  then
     begin
      StringGrid1.Canvas.Brush.Color := clinfobk;
      StringGrid1.Canvas.pen.Color := StringGrid1.Font.Color ;
      StringGrid1.canvas.fillRect(rect);
      StringGrid1.Canvas.textout(rect.left+1,rect.Top ,StringGrid1.cells[acol,arow]);
      end;end;
      

  4.   

    上面的是改变背景色
    左右居中,上下居中再加入代码:
     if arow=0  then
           begin
            if acol=0 then stringgrid1.canvas.textout(rect.left+15,rect.top+5,'姓名');
            if acol=1 then stringgrid1.canvas.textout(rect.left+5,rect.top+5,'日(月)薪');
            if acol=2 then stringgrid1.canvas.textout(rect.left+5,rect.top+5,'工作天数');
    end;
    是给一个固定的SELLS中的字符固定位置