Q&A

  • 퀀텀그리드에서 특정row에 색상주기
안녕하세요.
퀀텀db그리드를 사용하고있습니다.
퀀텀db그리드에서 어느 특정셀값에 따라 그 row의 모든 셀의 색상에 변화를 주고싶으면 어떻게 해야하는지요.
예를 들면 나이필드가 20세이하이면 그 row는 빨간색으로 표시하려 합니다
관련된 데모도 없고 좀 애매하네요.
부탁드리겠습니다.
1  COMMENTS
  • Profile
    Crazy™ 2005.04.09 18:26
    procedure TForm_CM00085R.dxDBGrid_MASTERCustomDrawCell(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.Values[dxDBGrid_MASTER.ColumnByFieldName('TOPSTS').Index] = 'Y' then
         begin
              AFont.Color := clBlue;
         end;
    end;

    참고로 ANode.Values[ColumnIndex] => ColumnIndex 는 그리드의 컬럼순서입니다.
    Visible가 False 컬럼까지 포함한 순서고 인덱스 번호는 0부터 시작합니다
    특정셀까지 색깔하실려면 AColumn.Index = dxDBGrid_MASTER.ColumnByFieldName('TOPSTS').Index 이런 조건만 추가하시면 되겠네요
    즐프~