Changeset 3335
- Timestamp:
- 04/13/10 18:27:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r3328 r3335 104 104 columnsTextBox.Enabled = true; 105 105 virtualRowIndizes = Enumerable.Range(0, Content.Rows).ToArray(); 106 dataGridView.RowCount = Content.Rows; 107 dataGridView.ColumnCount = Content.Columns; 106 //DataGridViews with Rows but no columns are not allowed ! 107 if (Content.Rows == 0 && dataGridView.RowCount != Content.Rows) 108 Content.Rows = dataGridView.RowCount; 109 else 110 dataGridView.RowCount = Content.Rows; 111 if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns) 112 Content.Columns = dataGridView.ColumnCount; 113 else 114 dataGridView.ColumnCount = Content.Columns; 108 115 UpdateRowHeaders(); 109 116 UpdateColumnHeaders(); … … 153 160 Invoke(new EventHandler<EventArgs<int, int>>(Content_ItemChanged), sender, e); 154 161 else 155 dataGridView.InvalidateCell(e.Value , e.Value2);162 dataGridView.InvalidateCell(e.Value2, e.Value); 156 163 } 157 164 private void Content_Reset(object sender, EventArgs e) { … … 172 179 private void rowsTextBox_Validating(object sender, CancelEventArgs e) { 173 180 int i = 0; 174 if (!int.TryParse(rowsTextBox.Text, out i) || (i < 0)) {181 if (!int.TryParse(rowsTextBox.Text, out i) || (i <= 0)) { 175 182 e.Cancel = true; 176 errorProvider.SetError(rowsTextBox, "Invalid Number of Rows (Valid Values: Positive Integers Larger or Equal to0)");183 errorProvider.SetError(rowsTextBox, "Invalid Number of Rows (Valid values are positive integers larger than 0)"); 177 184 rowsTextBox.SelectAll(); 178 185 } … … 194 201 private void columnsTextBox_Validating(object sender, CancelEventArgs e) { 195 202 int i = 0; 196 if (!int.TryParse(columnsTextBox.Text, out i) || (i < 0)) {203 if (!int.TryParse(columnsTextBox.Text, out i) || (i <= 0)) { 197 204 e.Cancel = true; 198 errorProvider.SetError(columnsTextBox, "Invalid Number of Columns (Valid Values: Positive Integers Larger or Equal to0)");205 errorProvider.SetError(columnsTextBox, "Invalid Number of Columns (Valid values are positive integers larger than 0)"); 199 206 columnsTextBox.SelectAll(); 200 207 } … … 239 246 private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { 240 247 int rowIndex = virtualRowIndizes[e.RowIndex]; 241 e.Value = Content.GetValue(rowIndex, e.ColumnIndex);242 }243 248 if (e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) 249 e.Value = Content.GetValue(rowIndex, e.ColumnIndex); 250 } 244 251 private void dataGridView_Scroll(object sender, ScrollEventArgs e) { 245 252 UpdateRowHeaders(); 246 253 } 247 248 254 private void dataGridView_Resize(object sender, EventArgs e) { 249 255 UpdateRowHeaders();
Note: See TracChangeset
for help on using the changeset viewer.