Exemplo n.º 1
0
        public void SetDataGrid(DataTable dataTbl, ArrayList arrList)
        {
            int            colCount = arrList.Count;
            ViewerCellSpec cellSpec = new ViewerCellSpec();

            DataGridViewTextBoxColumn[] col = new DataGridViewTextBoxColumn[colCount];
            for (int idx = 0; idx < colCount; idx++)
            {
                cellSpec = (ViewerCellSpec)arrList[idx];
            }
            dataGrid.DataSource = dataTbl;
            dataGrid.Columns.Clear();
            dataGrid.ReadOnly = true;
            for (int idx = 0; idx < colCount; idx++)
            {
                cellSpec                  = (ViewerCellSpec)arrList[idx];
                col[idx]                  = new DataGridViewTextBoxColumn();
                col[idx].Name             = cellSpec.fieldName;
                col[idx].HeaderText       = cellSpec.headerText;
                col[idx].Width            = cellSpec.columnWidth;
                col[idx].Visible          = cellSpec.Visible;
                col[idx].DefaultCellStyle = cellSpec.viewCellStyle;
                col[idx].DataPropertyName = cellSpec.fieldName;
                dataGrid.Columns.Add(col[idx]);
                dataGrid.Columns[idx].Visible = cellSpec.Visible;
            }
            SetGridSize(this.Width, this.Height);
        }
Exemplo n.º 2
0
 public void SetDataGrid(DataTable dataTbl, ArrayList arrList)
 {
     int colCount = arrList.Count;
     ViewerCellSpec cellSpec = new ViewerCellSpec();
     DataGridViewTextBoxColumn[] col = new DataGridViewTextBoxColumn[colCount];
     for (int idx = 0; idx < colCount; idx++)
     {
         cellSpec = (ViewerCellSpec)arrList[idx];
     }
     dataGrid.DataSource = dataTbl;
     dataGrid.Columns.Clear();
     dataGrid.ReadOnly = true;
     for (int idx = 0; idx < colCount; idx++)
     {
         cellSpec = (ViewerCellSpec)arrList[idx];
         col[idx] = new DataGridViewTextBoxColumn();
         col[idx].Name = cellSpec.fieldName;
         col[idx].HeaderText = cellSpec.headerText;
         col[idx].Width = cellSpec.columnWidth;
         col[idx].Visible = cellSpec.Visible;
         col[idx].DefaultCellStyle = cellSpec.viewCellStyle;
         col[idx].DataPropertyName = cellSpec.fieldName;
         dataGrid.Columns.Add(col[idx]);
         dataGrid.Columns[idx].Visible = cellSpec.Visible;
     }
     SetGridSize(this.Width, this.Height);
 }