ExpressQuantumGrid DxDBGrid中如何设置某行某列的颜色和只读性!好急

解决方案 »

  1.   

    DxDBGrid在设计的时候,打开数据集,然后,把双击DxDBGrid,选种某列,直接设置ReadOnly为True就行了,至于颜色,只有在运行的时候自己写代码了。
      

  2.   

    我觉得你要的功能好象不能实现,只要你使用的是Grid来显示的话都不能实现(个人意见),
    如果要实现那个功能,最好还是不用Grid来显示。
      

  3.   

    在OnEditing中根据node 和当前列判断,设置allow就可以了
      

  4.   

    只读,在某列中的properties中选中列的类型后,会出现一个readonly属性,设为true
    颜色 CustomDrawCell中设置
    ACanvas.SetBrushColor(clRed);
      

  5.   

    定义activeCol :integer;procedure TForm1.dxDBGrid1Editing(Sender: TObject; Node: TdxTreeListNode;
      var Allow: Boolean);
    begin
      Allow := True;
      if (Node.Index =1) and (activeCol=0) then Allow := False;
      if (Node.Index =2) and (activeCol=3) then Allow := False;
    end;procedure TForm1.dxDBGrid1ChangeColumn(Sender: TObject;
      Node: TdxTreeListNode; Column: Integer);
    begin
      activeCol := Column;
    end;procedure TForm1.dxDBGrid1CustomDrawCell(Sender: TObject; ACanvas: TCanvas;
      ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn;
      ASelected, AFocused, ANewItemRow: Boolean; var AText: String;
      var AColor: TColor; AFont: TFont; var AAlignment: TAlignment;
      var ADone: Boolean);
    begin
      if (ANode.Index =1) and (AColumn.Index=0) then AColor := clRed;
      if (ANode.Index =2) and (AColumn.Index=3) then AColor := clRed;
    end;