Changeset 4850


Ignore:
Timestamp:
11/19/10 13:51:45 (9 years ago)
Author:
mkommend
Message:

Improved performance of StringConvertibleMatrixView when dealing with lots of columns (ticket #1283).

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

    r4779 r4850  
    9090                  | System.Windows.Forms.AnchorStyles.Right)));
    9191      this.dataGridView.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable;
    92       this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     92      this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
    9393      this.dataGridView.Location = new System.Drawing.Point(0, 52);
    9494      this.dataGridView.Name = "dataGridView";
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r4819 r4850  
    124124      columnsTextBox.Text = Content.Columns.ToString();
    125125      columnsTextBox.Enabled = true;
     126      virtualRowIndizes = Enumerable.Range(0, Content.Rows).ToArray();
     127
     128      if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns && !Content.ReadOnly)
     129        Content.Columns = dataGridView.ColumnCount;
     130      else {
     131        DataGridViewColumn[] columns = new DataGridViewColumn[Content.Columns];
     132        for (int i = 0; i < columns.Length; ++i) {
     133          var column = new DataGridViewTextBoxColumn();
     134          column.FillWeight = 1;
     135          columns[i] = column;
     136        }
     137        dataGridView.Columns.Clear();
     138        dataGridView.Columns.AddRange(columns);
     139      }
    126140
    127141      //DataGridViews with rows but no columns are not allowed !
     
    130144      else
    131145        dataGridView.RowCount = Content.Rows;
    132       if (Content.Columns == 0 && dataGridView.ColumnCount != Content.Columns && !Content.ReadOnly)
    133         Content.Columns = dataGridView.ColumnCount;
    134       else
    135         dataGridView.ColumnCount = Content.Columns;
     146
    136147
    137148      ClearSorting();
    138 
    139149      UpdateColumnHeaders();
    140150      UpdateRowHeaders();
Note: See TracChangeset for help on using the changeset viewer.