Changeset 8537


Ignore:
Timestamp:
08/29/12 16:43:01 (7 years ago)
Author:
mkommend
Message:

#1292: Improved drawing of feature correlation view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelationView.cs

    r8529 r8537  
    7979        PartitionComboBox.DataSource = Content.Partitions;
    8080        CalculateCorrelation();
     81      } else {
     82        DataGridView.Columns.Clear();
     83        DataGridView.Rows.Clear();
    8184      }
    8285    }
     
    145148
    146149    protected void DataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) {
    147       if (Content != null && DataGridView.Enabled && e.RowIndex < Content.Rows && e.ColumnIndex < Content.Columns) {
    148         int rowIndex = virtualRowIndices[e.RowIndex];
    149         e.Value = Content[rowIndex, e.ColumnIndex];
    150       }
     150      if (Content == null) return;
     151      int rowIndex = virtualRowIndices[e.RowIndex];
     152      e.Value = Content[rowIndex, e.ColumnIndex];
    151153    }
    152154
    153155    protected void DataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {
    154       if (Content != null && DataGridView.Enabled && e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) {
    155         int rowIndex = virtualRowIndices[e.RowIndex];
    156         e.CellStyle.BackColor = GetDataPointColor(Content[rowIndex, e.ColumnIndex], Content.Minimum, Content.Maximum);
    157       }
    158       e.Paint(e.CellBounds, e.PaintParts);
     156      //if (Content != null && DataGridView.Enabled && e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) {
     157      //  int rowIndex = virtualRowIndices[e.RowIndex];
     158      //e.CellStyle.BackColor = GetDataPointColor(Content[rowIndex, e.ColumnIndex], Content.Minimum, Content.Maximum);
     159      //}
     160      //e.Paint(e.CellBounds, e.PaintParts);
     161
     162      if (Content == null) return;
     163      if (e.RowIndex < 0) return;
     164      if (e.ColumnIndex < 0) return;
     165      if (e.State.HasFlag(DataGridViewElementStates.Selected)) return;
     166      if (!e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) return;
     167
     168      int rowIndex = virtualRowIndices[e.RowIndex];
     169      Color backColor = GetDataPointColor(Content[rowIndex, e.ColumnIndex], Content.Minimum, Content.Maximum);
     170      using (Brush backColorBrush = new SolidBrush(backColor)) {
     171        e.Graphics.FillRectangle(backColorBrush, e.CellBounds);
     172      }
     173      e.PaintContent(e.CellBounds);
     174      e.Handled = true;
    159175    }
    160176
Note: See TracChangeset for help on using the changeset viewer.