在dxDbGrid中如何某个字段所在行的字体变色
例如dxDbGrid1中显示table1表中lee,see字段其中lee为空的行为蓝色不为空的为黑色

解决方案 »

  1.   

    procedure TForm1.DxDbgrid1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumn;
      State: TGridDrawState);
    begin  
      if adoquery1.FieldByName('lee').AsString='' then  DxDbgrid1.Canvas.Color:=clBlue
      else  DxDbgrid1.Canvas.Color:=clBlack;
      DxDbgrid1.DefaultDrawColumnCell(rect,DataCol,column,state);
    end;
      

  2.   

    不会吧大哥好像DxDbgrid1没有onDrawColumnCell事件
      

  3.   

    太简单了,里面有样式的控件,然后在DXDBGRID中选中样式就OK了,DEMO里面全是的啊
      

  4.   

    procedure TForm1.DxDbgrid1CustomDrawCell(Sender: TObject; ACanvas:TCanvas; ARect:TRect;
      ANode:TdxTreeListNode; AColumn: TTreeListColumn;   ASelected,AFocused,ANewItemRow:Boolean;
      var AText:string;var AColor:TColor; AFont:TFont; var AAlognment:TAlognment; 
    var ADone:Boolean);
    begin  
      if ANode.Values[] := '' then then  AColor:=clBlue
      else  AColorColor:=clBlack;
    end;Values[] 方括号里面写你所要的那个字段在dxdbGrid中所在的列数。
    试一下,可以吗?