c# devexpress 动态创建bandedGridView 和gridcolumn
·
bandedGridView1 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridView();

this.gridControl1 = new DevExpress.XtraGrid.GridControl(); this.bandedGridView1 = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridView();/* 创建BandedGridView对象 */ this.bdgcolID = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn();/* 创建列 */ this.bdgcolName = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn();/* */ this.bdgcolPhoto = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn();/* */ this.bdgcolPhotoName = new DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn();/* */ this.gridBand1 = new DevExpress.XtraGrid.Views.BandedGrid.GridBand();/* 创建列头分组 */ this.gridBand2 = new DevExpress.XtraGrid.Views.BandedGrid.GridBand();/* */ this.gridBand3 = new DevExpress.XtraGrid.Views.BandedGrid.GridBand();/* */ ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bandedGridView1)).BeginInit(); this.SuspendLayout();
bandedGridView1 添加分组 GridBand
//
// bandedGridView1
//
this.bandedGridView1.Bands.AddRange
(
new DevExpress.XtraGrid.Views.BandedGrid.GridBand[]
{
this.gridBand1
}
);

添加分组 以及分组添加列

//
// gridBand1
//
this.gridBand1.Caption = "上等";
/* 分组 添加 子分组 */
this.gridBand1.Children.AddRange(new DevExpress.XtraGrid.Views.BandedGrid.GridBand[] { this.gridBand2,this.gridBand3});
this.gridBand1.MinWidth = 16;
this.gridBand1.Name = "gridBand1";
this.gridBand1.VisibleIndex = 0;
this.gridBand1.Width = 472;
//
// gridBand2
//
this.gridBand2.Caption = "违规";
/*子分组 添加 数据列*/
this.gridBand2.Columns.Add(this.bdgcolID);
this.gridBand2.MinWidth = 12;
this.gridBand2.Name = "gridBand2";
this.gridBand2.VisibleIndex = 0;
this.gridBand2.Width = 118;
//
// gridBand3
//
this.gridBand3.Caption = "是否感叹号";
/*子分组 添加 数据列*/
this.gridBand3.Columns.Add(this.bdgcolName);
this.gridBand3.Columns.Add(this.bdgcolPhoto);
this.gridBand3.Columns.Add(this.bdgcolPhotoName);
this.gridBand3.Name = "gridBand3";
this.gridBand3.VisibleIndex = 1;
this.gridBand3.Width = 354;
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)