DevExpress 同一个窗体多个表格

2021-02-19 20:20

阅读:751

标签:options   util   tco   span   def   ntc   否则   idc   for   

多个表格使用相同列信息时,需要分别添加列信息,不能使用同一个列对象,再创建一个新对象进行添加,否则只能操作一个表格信息

int index = 0;
            List ColumnList = new List();
            ColumnList.Add(new GridColumn() { VisibleIndex = index++, Width = 150, FieldName = "CinemaName", Caption = "影院", Name = "CinemaName", Fixed = FixedStyle.Left });
            ColumnList.Add(new GridColumn() { VisibleIndex = index++, Width = 80, FieldName = "City", Name = "City", Caption = "城市", Fixed = FixedStyle.Left });
            ColumnList.Add(new GridColumn() { VisibleIndex = index++, Width = 80, FieldName = "PointCode", Name = "PointCode", Caption = "点位编号", Fixed = FixedStyle.Left });
            ColumnList.Add(new GridColumn() { VisibleIndex = index++, Width = 60, FieldName = "PointType", Name = "PointType", Caption = "点位类型" });
            ColumnList.Add(new GridColumn() { VisibleIndex = index++, Width = 60, FieldName = "MediaType", Name = "MediaType", Caption = "媒体形式" });
            foreach (GridColumn item in ColumnList)
            {
                if (item.Name != "CinemaName")
                {
                    item.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False;
                }
                gridView1.Columns.Add(item);

                GridColumn col = new GridColumn()
                {
                    VisibleIndex = item.VisibleIndex,
                    Width = item.Width,
                    FieldName = item.FieldName,
                    Caption = item.Caption,
                    Name = item.Name,
                    Fixed = item.Fixed
                };
                col.OptionsColumn.AllowMerge = item.OptionsColumn.AllowMerge;
                gridView2.Columns.Add(col);
            }

 

DevExpress 同一个窗体多个表格

标签:options   util   tco   span   def   ntc   否则   idc   for   

原文地址:https://www.cnblogs.com/tian2008/p/8308940.html


评论


亲,登录后才可以留言!