Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4199


Ignore:
Timestamp:
08/11/10 17:36:21 (12 years ago)
Author:
mkommend
Message:

corrected StringConvertibleMatrixView (ticket #1134)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r4178 r4199  
    3434  [Content(typeof(IStringConvertibleMatrix), true)]
    3535  public partial class StringConvertibleMatrixView : AsynchronousContentView {
    36     protected int[] virtualRowIndizes;
     36    private int[] virtualRowIndizes;
    3737    private List<KeyValuePair<int, SortOrder>> sortedColumnIndizes;
    3838    private RowComparer rowComparer;
     
    114114        dataGridView.ColumnCount = Content.Columns;
    115115
     116      UpdateColumnHeaders();
    116117      UpdateRowHeaders();
    117       UpdateColumnHeaders();
     118      dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
     119      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    118120      dataGridView.Enabled = true;
    119       dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    120     }
    121 
    122     private void UpdateColumnHeaders() {
     121    }
     122
     123    protected void UpdateColumnHeaders() {
    123124      for (int i = 0; i < dataGridView.ColumnCount; i++) {
    124125        if (Content.ColumnNames.Count() != 0)
     
    127128          dataGridView.Columns[i].HeaderText = "Column " + (i + 1);
    128129      }
    129       dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
    130     }
    131 
    132     private void UpdateRowHeaders() {
    133       int firstDisplayedRowIndex = dataGridView.FirstDisplayedScrollingRowIndex;
    134       if (firstDisplayedRowIndex == -1)
    135         firstDisplayedRowIndex = 0;
    136       int lastDisplaydRowIndex = firstDisplayedRowIndex + dataGridView.DisplayedRowCount(true);
    137 
    138       for (int i = firstDisplayedRowIndex; i < lastDisplaydRowIndex; i++) {
     130    }
     131    protected void UpdateRowHeaders() {
     132      int index = dataGridView.FirstDisplayedScrollingRowIndex;
     133      if (index == -1) index = 0;
     134      int updatedRows = 0;
     135      int count = dataGridView.DisplayedRowCount(true);
     136
     137      while (updatedRows < count) {
    139138        if (Content.RowNames.Count() != 0)
    140           dataGridView.Rows[i].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndizes[i]);
     139          dataGridView.Rows[index].HeaderCell.Value = Content.RowNames.ElementAt(virtualRowIndizes[index]);
    141140        else
    142           dataGridView.Rows[i].HeaderCell.Value = "Row " + (i + 1);
     141          dataGridView.Rows[index].HeaderCell.Value = "Row " + (index + 1);
     142        if (dataGridView.Rows[index].Visible)
     143          updatedRows++;
     144        index++;
    143145      }
    144146    }
Note: See TracChangeset for help on using the changeset viewer.