procedure TFrm_QForm.cxGridDBTableView1CustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var num:integer;
begin
    if colorbool = true then
        begin
       if  (strtoint(trim(AViewInfo.RecordViewInfo.GridRecord.Values[1]))<0)  then
        begin
         acanvas.Brush.Color:=clmaroon;
         acanvas.Font.Color:=clwhite;
         end;
    end; 
end;
这个是我在DRAWCELL里写的变色代码。我想把他写成函数。我写的就是改了个名字。别的都COPY过去。
编译不出错。但我不知道调用的时候里面参数要怎么添写。哪位能帮我添一下。用CXGRID1为例就行
下面是我的函数
procedure TForm2.drawcell(Sender: TcxCustomGridTableView;
  ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
  var ADone: Boolean);
begin    
       if  (strtoint(trim(AViewInfo.RecordViewInfo.GridRecord.Values[1]))<0)  then
        begin
         acanvas.Brush.Color:=clmaroon;
         acanvas.Font.Color:=clwhite;
         end;
end;
要怎么写叱???form2.drawcell(????,????,????,????)搞了二天了。没添上。谢谢各位大虾了哟~