When i right click on ultra grid view or may be grid view .
I want to display different contextmenu strip for different columns.
But when i right click i get index of column which i selected not which i right clicked.
How should i get it..
Code is as follows:
Private Sub DataGridView1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
If e.Button() = Windows.Forms.MouseButtons.Right Then
MessageBox.Show(DataGridView1.SelectedCells(0).ColumnIndex.ToString())
End If
End Sub
The best way to get UltraColumn under the cursor is to utilize MouseUp event of the UltraGrid class.
Here is sample in C# but i’m sure you will catch my idea: