gpt4 book ai didi

vb.net - vb.net中的上下文菜单位置

转载 作者:行者123 更新时间:2023-12-05 01:03:19 28 4
gpt4 key购买 nike

我有一个数据 GridView 。右键单击它会显示一个上下文菜单,但它始终位于右上角。我想要它,以便菜单出现在用户右键单击的单元格上。它可能是单元格 1 或单元格 2 或其他。

谢谢福尔坎

最佳答案

最简单的方法是在数据网格的 MouseDown 上自行处理显示上下文菜单(不使用 GridView 上的上下文菜单属性)。像这样:

Private Sub DataGridView1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
ContextMenuStrip1.Show(CType(sender, Control), e.Location)
End If
End Sub

关于vb.net - vb.net中的上下文菜单位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7913577/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com