cxgrid动态多表头
Posted 我的学习笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cxgrid动态多表头相关的知识,希望对你有一定的参考价值。
function TForm15.CreateBand(View: TcxGridDBBandedTableView;
BandCaption, ParentBandCaption: String): TcxGridBand; var band: TcxGridBand; begin Result := nil; if View = nil then exit; if ParentBandCaption <> ‘‘ then band := FMyList.Objects[FMyList.IndexOf(ParentBandCaption)] as TcxGridBand; Result := view.Bands.Add; with Result do begin Caption := BandCaption; if (BandCaption <> ‘‘) and (ParentBandCaption <> ‘‘) and (BandCaption <> ParentBandCaption) then begin Position.ColIndex := band.ColumnCount + 1; Position.BandIndex := band.Index; end else if (BandCaption = ‘‘) and (ParentBandCaption = ‘‘) then begin Position.ColIndex := FRootBandCount + 1; Position.BandIndex := -1; FMyBand := Result; end else begin Position.ColIndex := FRootBandCount + 1; Position.BandIndex := -1; end; end; end; function TForm15.CreateCol(View: TcxGridDBBandedTableView; FieldName: string;
BandCaption: string): TcxGridDBBandedColumn; var band: TcxGridBand; begin result := nil; if View = nil then Exit; if FieldName = ‘‘ then exit; if BandCaption = ‘‘ then Exit; band := FMyList.Objects[FMyList.IndexOf(BandCaption)] as TcxGridBand; Result := View.CreateColumn; with Result do begin DataBinding.FieldName := FieldName; Position.ColIndex := band.ColumnCount + 1; Position.BandIndex := band.Index; end; end; |
以上是关于cxgrid动态多表头的主要内容,如果未能解决你的问题,请参考以下文章