What is the problem with this code ?
Private Sub trvHeader_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles trvHeader.NodeMouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
trvHeader.SelectedNode = e.Node
开发者_StackOverflow Dim p As Point = New Point(e.X, e.Y)
mnuRoot.Show(p)
End If
End Sub
the context menu does not open in right position.
The ContextMenuStrip.Show(Point) overload requires the point to be in screen coordinates. Fix:
mnuRoot.Show(trvHeader, p)
or use Control.PointToScreen()
精彩评论