- Timestamp:
- 04/16/12 16:38:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/View/ColumnGroupView.cs
r7730 r7731 58 58 this.dataGridView.RowHeadersWidthChanged += new EventHandler(dataGridView_RowHeadersWidthChanged); 59 59 this.dataGridView.CellMouseEnter += new DataGridViewCellEventHandler(dataGridView_CellMouseEnter); 60 this.dataGridView.CellFormatting += new DataGridViewCellFormattingEventHandler(dataGridView_CellFormatting); 60 this.dataGridView.Scroll += new ScrollEventHandler(dataGridView_Scroll); 61 this.dataGridView.Resize += new EventHandler(dataGridView_Resize); 61 62 62 63 //delegates for virtual mode … … 296 297 } 297 298 299 UpdateDataGridViewHeaderCells(); 298 300 this.dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); 299 301 this.dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders); … … 311 313 this.dataGridView.Invalidate(); 312 314 UpdateStateInformation(); 315 } 316 317 private void UpdateDataGridViewHeaderCells() { 318 int index = dataGridView.FirstDisplayedScrollingRowIndex; 319 if (index == -1) index = 0; 320 int updatedRows = 0; 321 int count = dataGridView.DisplayedRowCount(true); 322 323 while (updatedRows < count) { 324 dataGridView.Rows[index].HeaderCell.Value = (index + 1).ToString(); 325 if (dataGridView.Rows[index].Visible) 326 updatedRows++; 327 index++; 328 } 313 329 } 314 330 … … 469 485 } 470 486 471 private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { 472 this.dataGridView.Rows[e.RowIndex].HeaderCell.Value = e.RowIndex.ToString(); 487 private void dataGridView_Resize(object sender, EventArgs e) { 488 UpdateDataGridViewHeaderCells(); 489 } 490 491 private void dataGridView_Scroll(object sender, ScrollEventArgs e) { 492 if (e.ScrollOrientation == ScrollOrientation.VerticalScroll) 493 UpdateDataGridViewHeaderCells(); 473 494 } 474 495
Note: See TracChangeset
for help on using the changeset viewer.