Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/14 10:52:00 (11 years ago)
Author:
mleitner
Message:

Autosize table columns and keep selection on refresh

Location:
branches/DataPreprocessing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/CopyOfStringConvertibleMatrixView.cs

    r10583 r10691  
    170170
    171171    private void UpdateData() {
     172
     173      Point[] selectedCellsBeforeUpdate = GetSelectedCellsAsPoints();
     174
    172175      rowsTextBox.Text = Content.Rows.ToString();
    173176      rowsTextBox.Enabled = true;
     
    195198        dataGridView.RowCount = Content.Rows;
    196199
    197 
    198200      ClearSorting();
    199201      UpdateColumnHeaders();
    200202      UpdateRowHeaders();
    201203
    202       dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
     204      dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
    203205      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    204206      dataGridView.Enabled = true;
     207
     208
     209      dataGridView.CurrentCell = null;
     210      foreach (Point p in selectedCellsBeforeUpdate)
     211        dataGridView[p.X, p.Y].Selected = true;
    205212    }
    206213
     
    257264      else
    258265        UpdateData();
     266    }
     267
     268    private Point[] GetSelectedCellsAsPoints() {
     269      Point[] points = new Point[dataGridView.SelectedCells.Count];
     270      for (int i = 0; i < dataGridView.SelectedCells.Count; i++)
     271      {
     272        points[i].X = dataGridView.SelectedCells[i].ColumnIndex;
     273        points[i].Y = dataGridView.SelectedCells[i].RowIndex;
     274      }
     275
     276      return points;
    259277    }
    260278
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/StatisticsView.cs

    r10558 r10691  
    111111        dataGridView.Rows[i].HeaderCell.Value = logic.GetVariableName(i);
    112112      }
     113
     114      dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
     115      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    113116      dataGridView.AllowUserToResizeColumns = true;
    114117    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs

    r10667 r10691  
    3232      this.preprocessingData = preprocessingData;
    3333    }
    34 
    3534
    3635    public bool[] Preview(IList<IFilter> filters)
Note: See TracChangeset for help on using the changeset viewer.