关于有条件的掩藏DBGridEh某一单元格的值,在HideDuplicates的基础上加上相应条件的方法

这篇博客介绍了如何在DBGridEh组件中,基于特定字段实现有条件地隐藏重复单元格的值。通过创建和使用TColCellParamsEh变量,结合FieldExit和GetFieldNameCol函数,动态判断是否显示横线,从而实现更灵活的数据展示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  TCustomDBGridEh = class(TCustomGridEh, IInplaceEditHolderEh {$IFNDEF CIL}, IUnknown {$ENDIF})
   ...

   FCol0Left:Integer;//添加变量用作记下第一列的焦点  //by thinkzhong

   ...

   FColCellParamsEh: TColCellParamsEh;
   FColCellParamsEh1: TColCellParamsEh;//添加变量 //by thinkzhong

   FUseduplicatekeyField:String; //by thinkzhong
   ...

   property UseduplicatekeyField: String read FUseduplicatekeyField write FUseduplicatekeyField; //thinkzhong
   ...

 

  TDBGridEh = class(TCustomDBGridEh)

  property UseduplicatekeyField; // thinkzhong

 

  constructor TCustomDBGridEh.Create(AOwner: TComponent);
  ...

   FColCellParamsEh := TColCellParamsEh.Create;
   FColCellParamsEh1 := TColCellParamsEh.Create;//建立变量 //by thinkzhong

   ...

 

  destructor TCustomDBGridEh.Destroy;

   FreeAndNil(FColCellParamsEh);
   FreeAndNil(FColCellParamsEh1);//释放变量 //by thinkzhong

 

   {new DrawCell}

   procedure TCustomDBGridEh.DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState);
   var

   ...

   Value: string;
   Value1: string//添加变量 //by thinkzhong

   DrawColumn: TColumnEh;
   DrawColumn1: TColumnEh; //添加变量 //by thinkzhong

   DrawSubLine: Boolean;//添加变量 //by thinkzhong

   ...

   //在变量里添加过程 //by thinkzhong

   function FieldExit(Dataset:TDataSet;FieldName:String):Boolean;
    var
  &n

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值