TStringGrid的网格线的颜色默认是灰色,有什么办法更改成其它颜色吗?

解决方案 »

  1.   

    在onDrawColumnCell中添加这个试试
    DBGrid1.Canvas.pen.Color := rgb(196,223,210) ;//定义背景颜色
        Dbgrid1.DefaultDrawColumnCell( Rect, DataCol, Column, [gdFixed,gdFocused,gdSelected] );
      

  2.   

    在DrawCell中
    with TStringGrid(Sender).Canvas do         //画 cell 的边框
            begin
                Pen.Color := FRowLineColor;         //定义画笔颜色(行)
                MoveTo(Rect.Left, Rect.Bottom);     //画笔定位
                LineTo(Rect.Right, Rect.Bottom);    //画蓝色的横线
                Pen.Color := FColLineColor;         //定义画笔颜色(列)
                MoveTo(Rect.Right, Rect.Top);       //画笔定位
                LineTo(Rect.Right, Rect.Bottom);    //画绿色的竖线
            end;