Category / Section
How to restrict the shortcut buttons in WinForms GridGroupingControl?
1 min read
Restrict the shortcut key
In order to restrict the command of the shortcut buttons in grid, ProcessCmdKey method of Form can be used. In the below article, the Ctrl+Shift+R key which invokes the reset command has been restricted.
C#
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //To restrict the Ctrl+Shift+R key. if(keyData==(Keys.Control | Keys.Shift | Keys.R)) { return true; } return base.ProcessCmdKey(ref msg, keyData); }
VB
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean 'To restrict the Ctrl+Shift+R key. If keyData=(Keys.Control Or Keys.Shift Or Keys.R) Then Return True End If Return MyBase.ProcessCmdKey(msg, keyData) End Function
Samples: