Does anyone know how I can disable the System Context Menu when a user right clicks in a DataGridViewTextBoxCell? I have tried to override the WndProc at the DataGridView level (as there is no WndProc to override on the Cell level), but nothing seems to work. Any help would be greatly appreciated.
The following is what I use to achieve this in a regular TextBox, however, I need to work the same way for a DataGridViewCell?
public class NoContextTextBox : TextBox {
private static readonly int WM_CONTEXTMENU = 123;
protected override void WndProc(ref Message m) {
if (m.Msg != WM_CONTEXTMENU) {
base.WndProc(ref m);
}
}
}