zoukankan      html  css  js  c++  java
  • Delphi-RzDbgrid-绘制表格式设置某行颜色或者其他格式-以及隔行换色的属性

    参考文章:https://www.cnblogs.com/OSKnown/p/8568740.html

    在DbgridEh和原生的Dbgrid直接在DrawColumnCell事件中写重绘代码就好了,

    但是使用Raize控件的RzDbgrid就不能出发事件,

    根据上文的建议,将DefaultDrawing这个属性默认的True属性改为False属性,

    然后在DrawColumnCell事件中写代码,就可以触发事件了。 

    不过新的问题出现,DrawColumnCell事件中写了测试代码,出现死循环, 

     1 procedure TFormSA.rzdbgrd1DrawColumnCell(Sender: TObject;
     2   const Rect: TRect; DataCol: Integer; Column: TColumn;
     3   State: TGridDrawState);
     4 var i:Integer;
     5 
     6 begin
     7     With rzdbgrd1.datasource.dataset do begin     
     8      if StrToInt(rzdbgrd1.DataSource.dataset.FieldValues['项次'])=11   then
     9      begin
    10        rzdbgrd1.Canvas.brush.Color :=clRed;
    11      end;
    12 
    13    end;
    14    rzdbgrd1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    15 end;

    循环条件,判断一下就好了。

    RzDbgrid-隔行换色的属性:AltRowShading设置为True,单双行颜色设置一下就可以了。

  • 相关阅读:
    python
    springboot-mybatis-pagehelper(分页插件)
    图片验证码工具类
    http工具类
    page工具类
    生成count位随机数工具类
    日期工具类
    dozer工具类
    list自定义排序工具类
    fastJson工具类
  • 原文地址:https://www.cnblogs.com/crrc/p/10999714.html
Copyright © 2011-2022 走看看