private void ChangeSpec() { if (sverPDataGrid.Rows.Count > 0) { SveraExportParam.ChangeSpec(sverPDataGrid, sveraExp.ExportP); } }
public ExportParams(SveraExportParam.ExportParametrs sveraExpP) { InitializeComponent(); try { if (Svera.Properties.Settings.Default.SveraExportSize != new Size(0, 0)) { this.Size = Svera.Properties.Settings.Default.SveraExportSize; } sveraExp = new SveraExportParam(sveraExpP); if (sveraExp.ColList.Count > 0) { DataGridViewColumn[] dataGridColSver = new DataGridViewColumn[sveraExp.ColList.Count]; ColumnNames colName; for (int i = 0; i <= sveraExp.ColList.Count - 1; i++) { colName = sveraExp.ColList[i]; dataGridColSver[i] = new DataGridViewTextBoxColumn(); dataGridColSver[i].Name = colName.nameColumn; dataGridColSver[i].HeaderText = colName.textColumn; dataGridColSver[i].SortMode = DataGridViewColumnSortMode.NotSortable; dataGridColSver[i].ReadOnly = colName.readOnly; } sverPDataGrid.Columns.AddRange(dataGridColSver); sverPDataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; sverPDataGrid.Columns[SveraParam.ColDatagridNames.Value].DefaultCellStyle.WrapMode = DataGridViewTriState.True; } if (sveraExp.RowList.Count > 0) { DataGridViewRow[] dataGridRowSver = new DataGridViewRow[sveraExp.RowList.Count]; RowsNames rowName; for (int i = 0; i <= sveraExp.RowList.Count - 1; i++) { rowName = sveraExp.RowList[i]; dataGridRowSver[i] = new DataGridViewRow(); dataGridRowSver[i].CreateCells(sverPDataGrid); if (sveraExp.RowList[i].dataCellType == typeof(DataGridViewComboBoxCell)) { DataGridViewComboBoxCell cc = new DataGridViewComboBoxCell(); cc.FlatStyle = FlatStyle.Flat; if (sveraExp.RowList[i].ArrayValue != null) { cc.Items.AddRange(sveraExp.RowList[i].ArrayValue); // cc.Value = sveraExp.RowList[i].NullValue; } dataGridRowSver[i].Cells[sverPDataGrid.Columns[SveraParam.ColDatagridNames.Value].Index] = cc; } dataGridRowSver[i].Cells[sverPDataGrid.Columns[SveraParam.ColDatagridNames.Parametr].Index].Value = sveraExp.RowList[i].textRow; dataGridRowSver[i].Tag = sveraExp.RowList[i].nameRow; if (sveraExp.RowList[i].readonlyT == true) { dataGridRowSver[i].ReadOnly = true; } } sverPDataGrid.Rows.AddRange(dataGridRowSver); } ChangeSpec(); SizeChange(); load = true; } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); if (ex.InnerException != null) { MessageBox.Show(ex.InnerException.ToString()); } } }
private void sverPDataGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { SveraExportParam.ChangeData(sverPDataGrid, sveraExp.ExportP, objectEditDataGrid, load, e.RowIndex, e.ColumnIndex); }