如何设置StringGrid控件的某行的颜色。我不想用第三方控件。能否有办法。

解决方案 »

  1.   

    可以了!
    给你启发!
    你那个DBGRID点,菜单上有个与EDITER有关的!
    然后添加列!
    改变列的COLOR,然后对应添加!列对应的字段!
    就ok了!
    我现在没有BCB,只能这么给你说了!
    希望能给你启发!
      

  2.   

    是StringGrid不是DBGrid,我用的是Delphi不是BCB。
      

  3.   

    使用STRINGGRID中使用不同的颜色
    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
    Rect: TRect; State: TGridDrawState);
    begin
    // if gdSelected in state then exit;with StringGrid1.canvas do beginif gdselected in state then
    beginbrush.color:=clBackground;Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
    textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);
    exit;
    end;
    if (arow=0) then//brush.color:=clScrollBar
    beginbrush.color:=clmenu;
    pen.color:=clblack;
    Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
    textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);
    exit;
    end
    else
    begin
    //pen.color:=$00EBEBEB;
    if (arow mod 2)=0 then
    begin
    brush.color:=$00EEEEEE;
    pen.color:=$00EEEEEE;
    end
    else
    begin
    brush.color:=$00F5F5EB;
    pen.color:= $00F5F5EB;
    end;
    end;Rectangle(Rect.Left-1, Rect.Top-1, Rect.Right+1, Rect.Bottom+1);
    //pen.color:=clblack;textout(rect.left,rect.top,stringgrid1.cells[acol,arow]);end;
    end;
      

  4.   

    http://expert.csdn.net/Expert/topic/1167/1167468.xml?temp=.3250849