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
你能帮我吗?
试试这个。您可以修改它以显示您的上下文菜单并禁用默认上下文菜单。
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { e.Control.ContextMenu = new ContextMenu(); }