网格的空白区域中的ContextMenuStrip [英] ContextMenuStrip in the empty area of a grid

查看:66
本文介绍了网格的空白区域中的ContextMenuStrip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在单击网格的空白区域时避免contextmenustrip

解决方案

为网格中的每一行而不是网格设置ContextMenuStrip属性. /blockquote>

我的答案是替代的.您的问题是菜单本身,但也可能是选择,因为菜单功能基于网格中的选择,对吗?

因此,请勿禁用菜单,而应根据选择修改菜单内容.如果这是System.Windows.Forms.ContextMenu,请使用事件Popup.例如,如果在菜单弹出窗口上未选择任何内容,则隐藏选择特定的项目,仅显示添加...",帮助"等.

–SA


How to avoid contextmenustrip while clicking in the empty area of a grid

解决方案

Set the ContextMenuStrip property for each row in the grid and not for the grid.


My answer is alternative. Your problem is net the menu itself, but probably selection, because you menu functionality is based on selection in a grid, right?

So, don''t disable menu, modify the menu content depending on selection. If this is System.Windows.Forms.ContextMenu use the event Popup. For example, if nothing is selected on menu popup, hide selection-specific items, display only "Add...", "Help", etc.

–SA


这篇关于网格的空白区域中的ContextMenuStrip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆