此代码有什么问题?
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
Dim p As Point = New Point(e.X, e.Y)
mnuRoot.Show(p)
End If
End Sub
上下文菜单无法在正确的位置打开。
答案 0 :(得分:1)
ContextMenuStrip.Show(Point)重载要求该点位于屏幕坐标中。修正:
mnuRoot.Show(trvHeader, p)
或使用Control.PointToScreen()