vb.net DataGridview 在正在编辑的单元格上显示自定义 ContextMenuStrip
我试图在我的 datagridview 上显示自定义上下文菜单条,它工作正常,除非正在编辑单元格。然后它显示默认的 Windows contextmenustrip 与复制/剪切/...
有没有办法覆盖 DataGridViewTextBoxCell contextmenustrip 或禁用它?
Disable DataGridView System ContextMenu 中的解决方案对我不起作用。
Private Sub DataGridView1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DocCostGroupDetsDataGridView.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
_CustomContextMenuStrip.fGetContextMenu()
_CustomContextMenuStrip.Show(DataGridView1, e.Location)
End If
End Sub
I'm trying to show a custom contextmenustrip on my datagridview and it works fine except when the cell is being being edited. Then it shows the default windows contextmenustrip with copy/cut/...
Is there a way to overwrite the DataGridViewTextBoxCell contextmenustrip or disable it?
The solution from Disable DataGridView System ContextMenu does'nt work for me.
Private Sub DataGridView1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DocCostGroupDetsDataGridView.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
_CustomContextMenuStrip.fGetContextMenu()
_CustomContextMenuStrip.Show(DataGridView1, e.Location)
End If
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)