Skip to content

Replies

0
Donald Bouchard
Donald Bouchard answered on Jul 7, 2011 7:11 PM

I would like to know if I right-clicked on the cell header.  How do I do this?

My current code:

    Private Sub ugCommission_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgsHandles ugCommission.MouseUp
 
        Dim cmItemNum As New ContextMenuStrip
        Dim cmCommDue As New ContextMenuStrip
 
        If e.Button = Windows.Forms.MouseButtons.Right Then
 
            Dim ptCurrent As Point = New Point(e.X, e.Y)
            Dim uiElement As Infragistics.Win.UIElement = CType(sender, UltraGrid).DisplayLayout.UIElement.ElementFromPoint(ptCurrent)
            Dim ugCell As UltraGridCell = uiElement.GetContext(GetType(UltraGridCell))
            Dim ugRow As UltraGridRow = uiElement.GetContext(GetType(UltraGridRow))
            ' Thought ugUIElement would be it, but it is also nothing when I right click on the col header cell
            Dim ugUIElement As UltraGridUIElement = uiElement.GetContext(GetType(UltraGridUIElement))             If ugCell IsNot Nothing Then                 ugCommission.Selected.Rows.Clear()                 ugRow.Selected = True                 If ugCell.Column.Key = "ITEM_NUM" Then                     _cmItemNum.Show(ugCommission, ptCurrent)                 ElseIf ugCell.Column.Key = "COMM_DUE" Then                     _cmCommDue.Show(ugCommission, ptCurrent)                 End If             End If         End If     End Sub