Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/09 10:01:06 (15 years ago)
Author:
mkommend
Message:

changed datasetview to use virtual mode in datagrid (ticket #4)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.cs

    r1901 r2124  
    5151      // another C# app (HL2) have the same numeric value
    5252      dataGridView.DefaultCellStyle.Format = "r";
     53
     54      //events for virtual mode of datagrid
     55      this.dataGridView.VirtualMode = true;
     56      this.dataGridView.CellValueNeeded += new DataGridViewCellValueEventHandler(dataGridView_CellValueNeeded);
    5357    }
    5458
     
    7579        dataGridView.ColumnCount = columns;
    7680        dataGridView.RowCount = rows;
    77         for (int i = 0; i < rows; i++) {
    78           for (int j = 0; j < columns; j++) {
    79             dataGridView.Rows[i].Cells[j].Value = Dataset.GetValue(i, j);
    80             dataGridView.Rows[i].HeaderCell.Value = i.ToString();
    81           }
    82         }
     81        //for (int i = 0; i < rows; i++) {
     82        //  for (int j = 0; j < columns; j++) {
     83        //    dataGridView.Rows[i].Cells[j].Value = Dataset.GetValue(i, j);
     84        //    dataGridView.Rows[i].HeaderCell.Value = i.ToString();
     85        //  }
     86        //}
    8387        for (int i = 0; i < columns; i++) {
    8488          dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; // SortMode has to be NotSortable to allow ColumnHeaderSelect
     
    106110    }
    107111
     112    private void dataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
     113      e.Value = Dataset.GetValue(e.RowIndex, e.ColumnIndex);
     114    }
    108115
    109116    private void SetArrayElement(int row, int column, string element) {
Note: See TracChangeset for help on using the changeset viewer.