Changeset 10574 for branches/DataPreprocessing
- Timestamp:
- 03/12/14 14:24:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10571 r10574 26 26 using HeuristicLab.Data.Views; 27 27 using HeuristicLab.MainForm; 28 using System.Drawing; 28 29 29 30 namespace HeuristicLab.DataPreprocessing.Views { … … 40 41 } 41 42 43 private IList<int> _highlightedRowIndices; 44 public IList<int> highlightedRowIndices 45 { 46 get { return _highlightedRowIndices; } 47 set 48 { 49 _highlightedRowIndices = value; 50 Refresh(); 51 } 52 } 53 42 54 public DataGridContentView() { 43 55 InitializeComponent(); 44 56 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 57 dataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(dataGridView_CellPainting); 45 58 contextMenuCell.Items.Add(ShowHideColumns); 46 59 } … … 100 113 } 101 114 115 protected void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) 116 { 117 if (Content == null) return; 118 if (e.RowIndex < 0) return; 119 if (e.ColumnIndex < 0) return; 120 if (e.State.HasFlag(DataGridViewElementStates.Selected)) return; 121 if (!e.PaintParts.HasFlag(DataGridViewPaintParts.Background)) return; 122 123 int rowIndex = virtualRowIndices[e.RowIndex]; 124 125 Color backColor = e.CellStyle.BackColor; 126 127 if (highlightedRowIndices != null && highlightedRowIndices.Contains(rowIndex)) 128 { 129 backColor = Color.Pink; 130 } 131 132 using (Brush backColorBrush = new SolidBrush(backColor)) 133 { 134 Rectangle bounds = new Rectangle(e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Width, e.CellBounds.Height); 135 e.Graphics.FillRectangle(backColorBrush, bounds); 136 } 137 138 using (Brush gridBrush = new SolidBrush(Color.LightGray)) 139 { 140 Pen gridLinePen = new Pen(gridBrush); 141 e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, 142 e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, 143 e.CellBounds.Bottom - 1); 144 e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1, 145 e.CellBounds.Top, e.CellBounds.Right - 1, 146 e.CellBounds.Bottom); 147 } 148 149 e.PaintContent(e.CellBounds); 150 e.Handled = true; 151 } 152 102 153 protected override int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) { 103 154 btnApplySort.Enabled = sortedColumns.Any();
Note: See TracChangeset
for help on using the changeset viewer.