Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的表单上有一个上下文菜单条,右键单击 datagridview 时显示。 问题是菜单显示在右上角,而我想在单击鼠标的位置显示它。
请指教。
谢谢
DataGridView 可以在 MouseDown 单击事件的位置自动显示 ContextMenuStrip。
为此,必须将属性 ContextMenuStrip 关联到菜单条的实际实例。您可以通过代码或直接在设计器中执行此操作
DataGridView1.ContextMenuStrip = ctxMenu;