Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12167


Ignore:
Timestamp:
03/09/15 16:00:26 (10 years ago)
Author:
ehopf
Message:

#2335: Swapped column left- and rightclick behavior in the DataGrid view, to be consistent with the row selection behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r12158 r12167  
    6161      dataGridView.KeyDown += dataGridView_KeyDown;
    6262      dataGridView.MouseUp += dataGridView_MouseUp;
    63       dataGridView.ColumnHeaderMouseClick += dataGridView_ColumnHeaderMouseClick;
    6463      contextMenuCell.Items.Add(ShowHideColumns);
    6564      _highlightedCellsBackground = new Dictionary<int, IList<int>>();
     
    164163    }
    165164
    166     private void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
     165    protected override void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
     166      if (Content != null) {
     167        if (e.Button == System.Windows.Forms.MouseButtons.Left) {
     168          dataGridView.Focus();
     169          dataGridView.ClearSelection();
     170          dataGridView.SelectionChanged -= dataGridView_SelectionChanged;
     171          for (int i = 0; i < dataGridView.RowCount; i++) {
     172            if (i + 1 == dataGridView.RowCount)
     173              dataGridView.SelectionChanged += dataGridView_SelectionChanged;
     174            dataGridView[e.ColumnIndex, i].Selected = true;
     175          }
     176        } else if (Content.SortableView) {
     177          SortColumn(e.ColumnIndex);
     178        }
     179      }
    167180      searchIterator = null;
    168181    }
     
    437450    private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
    438451      if (Content == null) return;
    439       if (e.Button == System.Windows.Forms.MouseButtons.Right) {
    440         if (e.ColumnIndex != -1 && e.RowIndex == -1) {
    441           dataGridView.Focus();
    442           dataGridView.ClearSelection();
    443           for (int r = 0; r < dataGridView.RowCount; r++) {
    444             dataGridView[e.ColumnIndex, r].Selected = true;
    445           }
    446           return;
    447         }
     452      if (e.Button == System.Windows.Forms.MouseButtons.Right && !(e.ColumnIndex != -1 && e.RowIndex == -1)) {
    448453        if (e.ColumnIndex == -1 || e.RowIndex == -1) {
    449454          replaceValueOverColumnToolStripMenuItem.Visible = false;
Note: See TracChangeset for help on using the changeset viewer.