/// <summary> /// Called when [right click]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DataGridViewCellMouseEventArgs" /> instance containing the event data.</param> public void OnRightClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { try { using var _columnConfiguration = new ColumnConfiguration(this); foreach (DataGridViewColumn c in Columns) { _columnConfiguration.ColumnListBox.Items.Add(c.HeaderText, c.Visible); } _columnConfiguration.ColumnListBox.Items.Clear(); _columnConfiguration.Location = PointToScreen(new Point(e.X, e.Y)); _columnConfiguration.ShowDialog(); } catch (Exception ex) { Fail(ex); } } }