Beispiel #1
0
        /// <summary>
        /// 绘制墓位表格
        /// </summary>
        /// <param name="nodeId"></param>
        private void DrawGrid(string nodeId)
        {
            int rows = MiscAction.GetRowerCount(nodeId);
            int cols = MiscAction.GetMaxCols(nodeId);

            gridView1.BeginUpdate();

            /////////清除所有数据
            gridTable.Rows.Clear();
            gridTable.Columns.Clear();

            gridView1.RowHeight = AppInfo.GRID_HEIGHT;

            ////生成列
            DataColumn col = null;
            DataRow    row = null;
            int        i_begin, i_end;

            for (int i = 1; i <= cols; i++)
            {
                col          = new DataColumn("col" + i.ToString(), typeof(string));
                col.ReadOnly = true;
                gridTable.Columns.Add(col);
            }

            DataRow[] bit_arry = null;
            //DataRow[] rower_arry = dt_rg01.Select("RG009='" + nodeId + "'", "RG001 ASC");

            for (int i = 0; i <= rows - 1; i++)
            {
                row      = gridTable.NewRow();
                bit_arry = dt_bi01.Select("RE001='" + rower_arry[i]["RG001"].ToString() + "'", "BI002 ASC");
                i_begin  = Convert.ToInt32(rower_arry[i]["RG005"].ToString());
                i_end    = Convert.ToInt32(rower_arry[i]["RG006"].ToString());


                for (int j = 1; j <= cols; j++)
                {
                    if (j <= (i_end - i_begin + 1))
                    {
                        row.SetField(j - 1, bit_arry[j - 1]["BI003"]);
                    }
                    else
                    {
                        row.SetField(j - 1, "");
                    }
                }
                gridTable.Rows.Add(row);
            }

            gridControl1.DataSource = gridTable;
            gridView1.PopulateColumns();


            //设置列宽
            for (int i = 1; i <= cols; i++)
            {
                gridView1.Columns[i - 1].Width = AppInfo.GRID_WIDTH;
            }

            //grid标题
            gridView1.ViewCaption = treeList1.FocusedNode.GetValue("RG003").ToString();
            gridView1.EndUpdate();
        }