예제 #1
0
            public MRow AddMRow(string UN, string N, short CC, short LD)
            {
                MRow rowMRow = ((MRow)(this.NewRow()));

                rowMRow.ItemArray = new object[] {
                    UN,
                    N,
                    CC,
                    LD
                };
                this.Rows.Add(rowMRow);
                return(rowMRow);
            }
예제 #2
0
        public static MDataTable GetDataTable <T>(IList <T> list)
        {
            //检查实体集合不能为空
            if (list == null || list.Count < 1)
            {
                return(new MDataTable());
            }

            //取出第一个实体的所有Propertie
            Type entityType = list[0].GetType();

            PropertyInfo[] entityProperties = entityType.GetProperties();

            //生成DataTable的structure
            //生产代码中,应将生成的DataTable结构Cache起来,此处略
            var dt = new MDataTable();

            foreach (PropertyInfo t in entityProperties)
            {
                object value = t.GetValue(list[0], null);
                if (value == null)
                {
                    dt.Columns.Add(new MColumn(t.Name, typeof(string)));
                }
                else
                {
                    dt.Columns.Add(new MColumn(t.Name, value.GetType()));
                }
            }
            //将所有entity添加到DataTable中
            foreach (object entity in list)
            {
                //检查所有的的实体都为同一类型
                if (entity.GetType() != entityType)
                {
                    continue;
                }
                var entityValues = new object[entityProperties.Length];
                for (int i = 0; i < entityProperties.Length; i++)
                {
                    entityValues[i] = entityProperties[i].GetValue(entity, null);
                }
                var row = new MRow(dt.Columns);
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    row.AddCell(dt.Columns[i], entityValues[i]);
                }
                dt.Rows.Add(row);
            }
            return(dt);
        }
 public MRowChangeEvent(MRow row, global::System.Data.DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
 public void RemoveMRow(MRow row) {
     this.Rows.Remove(row);
 }
 public void AddMRow(MRow row) {
     this.Rows.Add(row);
 }
예제 #6
0
 public override void Draw(Node tableNode, PaintMode printMode, Color color)
 {
     if ((printMode == PaintMode.BACKGROUND))
     {
         base.painter_.FillRectangle(tableNode);
     }
     else
     {
         if (tableNode.NotBlack())
         {
             color = tableNode.style_.color;
         }
         if (this.table.frame == TableLineStyle.SOLID)
         {
             tableNode.box.Width = this.table.totalHorzFrameSpacing;
             base.painter_.Rectangle(tableNode, color);
             tableNode.box.Width = this.table.totalWidth;
         }
         else if (this.table.frame == TableLineStyle.DASHED)
         {
             tableNode.box.Width = this.table.totalHorzFrameSpacing;
             base.painter_.DrawNodeRect(tableNode, color);
             tableNode.box.Width = this.table.totalWidth;
         }
         for (int i = 0; i < this.table.RowCount; i++)
         {
             MRow row = this.table.GetRow(i);
             for (int j = 0; j < row.Count; j++)
             {
                 MCell cell    = (MCell)row.cells[j];
                 int   rspan   = 0;
                 int   colSpan = 0;
                 rspan   = (i + cell.rowSpan) - 1;
                 colSpan = cell.colSpan;
                 if (rspan < (this.table.RowCount - 1))
                 {
                     int x1 = 0;
                     int x2 = 0;
                     int y1 = 0;
                     if (colSpan == 0)
                     {
                         x1 = base.rect.x;
                     }
                     else
                     {
                         x1 = (base.rect.x + this.table.spanBases[colSpan]) - (this.table.spanWidth[colSpan - 1] / 2);
                     }
                     if (colSpan == (this.table.ColCount - 1))
                     {
                         x2 = base.rect.x + this.table.totalHorzFrameSpacing;
                     }
                     else
                     {
                         x2 = ((base.rect.x + this.table.spanBases[(colSpan + cell.columnSpan) - 1]) + this.table.spanHeight[(colSpan + cell.columnSpan) - 1]) + (this.table.spanWidth[(colSpan + cell.columnSpan) - 1] / 2);
                     }
                     y1 = (row.node.box.Y + this.table.rowspanWidth(i, cell.rowSpan)) + (this.table.spacingWidth[rspan] / 2);
                     if (row.lines == TableLineStyle.SOLID)
                     {
                         base.painter_.DrawLine(x1, y1, x2, y1, color);
                     }
                     else if (row.lines == TableLineStyle.DASHED)
                     {
                         base.painter_.DrawDashLine(x1, y1, x2, y1, color);
                     }
                 }
             }
         }
         for (int i = 0; i < this.table.RowCount; i++)
         {
             MRow row = this.table.GetRow(i);
             for (int j = 0; j < row.Count; j++)
             {
                 MCell cell = (MCell)row.cells[j];
                 int   cspn = (cell.colSpan + cell.columnSpan) - 1;
                 if (cspn < (this.table.ColCount - 1))
                 {
                     int x1 = 0;
                     int y1 = 0;
                     int y2 = 0;
                     int hh = 0;
                     for (int k = 0; k < cell.rowSpan; k++)
                     {
                         MRow rrow = this.table.GetRow(i + k);
                         hh += rrow.node.box.Height;
                         if (k < (cell.rowSpan - 1))
                         {
                             hh += this.table.spacingWidth[i + k];
                         }
                     }
                     x1 = ((base.rect.x + this.table.spanBases[cspn]) + this.table.spanHeight[cspn]) + (this.table.spanWidth[cspn] / 2);
                     if (i == 0)
                     {
                         y1 = base.rect.y;
                     }
                     else
                     {
                         y1 = row.node.box.Y - (this.table.spacingWidth[i - 1] / 2);
                     }
                     if ((i + (cell.rowSpan - 1)) == (this.table.RowCount - 1))
                     {
                         y2 = base.rect.y + base.rect.height;
                     }
                     else
                     {
                         y2 = (row.node.box.Y + hh) + (this.table.spacingWidth[i] / 2);
                     }
                     if (this.table.colLines[cspn] == TableLineStyle.SOLID)
                     {
                         base.painter_.DrawLine(x1, y1, x1, y2, color);
                     }
                     else if (this.table.colLines[cspn] == TableLineStyle.DASHED)
                     {
                         base.painter_.DrawDashLine(x1, y1, x1, y2, color);
                     }
                 }
             }
         }
         for (int i = 0; i < this.table.RowCount; i++)
         {
             MRow row = this.table.GetRow(i);
             if (row.isLabeled)
             {
                 row.node.box.Width = this.table.totalWidth;
             }
         }
     }
 }
예제 #7
0
 public MRowChangeEvent(MRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
예제 #8
0
 public MRowChangeEvent(MRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
예제 #9
0
 public void RemoveMRow(MRow row)
 {
     this.Rows.Remove(row);
 }
예제 #10
0
 public void AddMRow(MRow row)
 {
     this.Rows.Add(row);
 }
 public MRowChangeEvent(MRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
 public Vector4fd RowVector(MRow row) => RowVector((int)row);
 public                RefVector4f this[MRow row] => RowVectorRef((int)row);