valuelisteditor怎么实现左边一列改变背景色,右边一列字体颜色设置?

解决方案 »

  1.   

    //参考如下代码:
    type
      TValueListEditorAccess = class(TValueListEditor);procedure TForm1.ValueListEditor1DrawCell(Sender: TObject; ACol,
      ARow: Integer; Rect: TRect; State: TGridDrawState);
    begin
      TValueListEditorAccess(Sender).OnDrawCell := nil;
      if (ACol = 0) and (ARow > 0) then
        TValueListEditorAccess(Sender).Canvas.Brush.Color := $00C0DCC0;
      if (ACol = 1) and (ARow > 0) then
        TValueListEditorAccess(Sender).Canvas.Font.Color := clRed;
      TValueListEditorAccess(Sender).DrawCell(ACol, ARow, Rect, State);
      TValueListEditorAccess(Sender).OnDrawCell := ValueListEditor1DrawCell;
    end;