Changeset 3936
- Timestamp:
- 06/21/10 16:46:44 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Data.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.Designer.cs
r3643 r3936 88 88 | System.Windows.Forms.AnchorStyles.Left) 89 89 | System.Windows.Forms.AnchorStyles.Right))); 90 this.dataGridView.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText;91 90 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 92 91 this.dataGridView.Location = new System.Drawing.Point(0, 52); -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r3904 r3936 84 84 dataGridView.Columns.Clear(); 85 85 virtualRowIndizes = new int[0]; 86 } else 86 } else 87 87 UpdateData(); 88 88 } … … 99 99 100 100 private void UpdateData() { 101 sortedColumnIndizes.Clear();101 ClearSorting(); 102 102 rowsTextBox.Text = Content.Rows.ToString(); 103 103 rowsTextBox.Enabled = true; 104 104 columnsTextBox.Text = Content.Columns.ToString(); 105 105 columnsTextBox.Enabled = true; 106 virtualRowIndizes = Enumerable.Range(0, Content.Rows).ToArray();107 106 //DataGridViews with Rows but no columns are not allowed ! 108 107 if (Content.Rows == 0 && dataGridView.RowCount != Content.Rows && !Content.ReadOnly) … … 115 114 dataGridView.ColumnCount = Content.Columns; 116 115 117 Sort();118 116 UpdateRowHeaders(); 119 117 UpdateColumnHeaders(); 120 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);121 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);122 118 dataGridView.Enabled = true; 123 119 } 124 120 125 121 private void UpdateColumnHeaders() { 126 for (int i = 0; i < Content.Columns; i++) { 122 int firstDisplayedColumnIndex = this.dataGridView.FirstDisplayedScrollingColumnIndex; 123 if (firstDisplayedColumnIndex == -1) 124 firstDisplayedColumnIndex = 0; 125 int lastDisplayedColumnIndex = firstDisplayedColumnIndex + dataGridView.DisplayedColumnCount(true); 126 for (int i = firstDisplayedColumnIndex; i < lastDisplayedColumnIndex; i++) { 127 127 if (Content.ColumnNames.Count() != 0) 128 128 dataGridView.Columns[i].HeaderText = Content.ColumnNames.ElementAt(i); … … 130 130 dataGridView.Columns[i].HeaderText = "Column " + (i + 1); 131 131 } 132 dataGridView. Invalidate();132 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader); 133 133 } 134 134 135 135 private void UpdateRowHeaders() { 136 for (int i = 0; i < dataGridView.RowCount; i++) { 136 int firstDisplayedRowIndex = dataGridView.FirstDisplayedScrollingRowIndex; 137 if(firstDisplayedRowIndex == -1) 138 firstDisplayedRowIndex = 0; 139 int lastDisplaydRowIndex = firstDisplayedRowIndex + dataGridView.DisplayedRowCount(true); 140 for (int i = firstDisplayedRowIndex; i < lastDisplaydRowIndex; i++) { 137 141 if (Content.RowNames.Count() != 0) 138 142 dataGridView.Rows[i].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndizes[i]); … … 140 144 dataGridView.Rows[i].HeaderCell.Value = "Row " + (i + 1); 141 145 } 142 dataGridView. Invalidate();146 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders); 143 147 } 144 148 … … 244 248 private void dataGridView_Scroll(object sender, ScrollEventArgs e) { 245 249 UpdateRowHeaders(); 250 UpdateColumnHeaders(); 246 251 } 247 252 private void dataGridView_Resize(object sender, EventArgs e) { 248 253 UpdateRowHeaders(); 254 UpdateColumnHeaders(); 249 255 } 250 256
Note: See TracChangeset
for help on using the changeset viewer.