Changeset 10668
- Timestamp:
- 03/26/14 15:25:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10659 r10668 62 62 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 63 63 dataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(dataGridView_CellPainting); 64 dataGridView.Key Up += dataGridView_KeyUp;64 dataGridView.KeyDown += dataGridView_KeyDown; 65 65 contextMenuCell.Items.Add(ShowHideColumns); 66 66 _highlightedCells = new Dictionary<int, IList<int>>(); … … 138 138 } 139 139 140 private void dataGridView_KeyUp(object sender, KeyEventArgs e) { 141 var selectedRows = dataGridView.SelectedRows; 142 if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) { 143 List<int> rows = new List<int>(); 144 for (int i = 0; i < selectedRows.Count; ++i) { 145 rows.Add(selectedRows[i].Index); 146 } 147 triggersOwnEvent(() => { 148 Content.DataGridLogic.DeleteRow(rows); 149 OnContentChanged(); 150 }); 151 } else if (e.Control && e.KeyCode == Keys.F) { 152 CreateFindAndReplaceDialog(); 153 findAndReplaceDialog.ActivateSearch(); 154 } else if (e.Control && e.KeyCode == Keys.R) { 155 CreateFindAndReplaceDialog(); 156 findAndReplaceDialog.ActivateReplace(); 157 } 158 } 140 159 141 160 142 private void CreateFindAndReplaceDialog() { … … 227 209 e.Graphics.FillRectangle(backColorBrush, bounds); 228 210 } 229 211 230 212 using (Brush gridBrush = new SolidBrush(Color.LightGray)) { 231 213 Pen gridLinePen = new Pen(gridBrush); … … 242 224 } 243 225 226 void dataGridView_KeyDown(object sender, KeyEventArgs e) { 227 var selectedRows = dataGridView.SelectedRows; 228 if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) { 229 List<int> rows = new List<int>(); 230 for (int i = 0; i < selectedRows.Count; ++i) { 231 rows.Add(selectedRows[i].Index); 232 } 233 triggersOwnEvent(() => { 234 Content.DataGridLogic.DeleteRow(rows); 235 OnContentChanged(); 236 }); 237 } else if (e.Control && e.KeyCode == Keys.F) { 238 CreateFindAndReplaceDialog(); 239 findAndReplaceDialog.ActivateSearch(); 240 } else if (e.Control && e.KeyCode == Keys.R) { 241 CreateFindAndReplaceDialog(); 242 findAndReplaceDialog.ActivateReplace(); 243 } 244 } 245 244 246 protected override int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) { 245 247 btnApplySort.Enabled = sortedColumns.Any();
Note: See TracChangeset
for help on using the changeset viewer.