码迷,mamicode.com
首页 > 其他好文 > 详细

cxgrid动态多表头

时间:2018-05-08 20:54:41      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:tableview   form   ntb   func   The   多表   tab   result   for   

 

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动态多表头

标签:tableview   form   ntb   func   The   多表   tab   result   for   

原文地址:https://www.cnblogs.com/westsoft/p/9010563.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!