在选定的 TreeView 节点上打开上下文菜单
这段代码有什么问题?
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
上下文菜单未在正确的位置打开。
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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ContextMenuStrip.Show(Point) 重载要求该点位于屏幕坐标中。修复:
或使用 Control.PointToScreen()
The ContextMenuStrip.Show(Point) overload requires the point to be in screen coordinates. Fix:
or use Control.PointToScreen()