Hi Diago,
I would create a control that inherits from DataGrid then override the
ProcessCmdKey method to catch your key combination. The keyData field is a
logical ORing of all currently pressed keys, so an example of how to catch a
Ctrl + Shift + P key combination pressed by the user is given below:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
//Want to catch ctrl + shift + P
Keys keyCombination = Keys.Control | Keys.Shift | Keys.P;
if ((keyData & keyCombination) == keyCombination)
{
//do whatever you want to do.
}
return false;
}
Hope that helps
Mark R Dawson
http://www.markdawson.org
"Diogo Alves - Software Developer" wrote:
I'm tring to override the combination all the combination like this one Ctrl
+ Shift + [another key]. I just can't catch it... I have already done this
for ctrl + [any other key] or Shift + [any other key] but for both at same
timeI can't do it....
Can someone tell me how to do it
Here is an example of how I am doing this:
if ((msg.Msg == WM_KEYDOWN) && (keyCode == Keys.Down))
{
if (Control.ModifierKeys == Keys.Shift)
{
return true;
}
}