Deste jeito:
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
// Determine whether the key entered is the F1 key. If it is, display Help.
if(e.KeyCode == Keys.F1 && (e.Alt || e.Control || e.Shift))
{
// Display a pop-up Help topic to assist the user.
Help.ShowPopup(textBox1, "Enter your name.", new Point(textBox1.Bottom, textBox1.Right));
}
else if(e.KeyCode == Keys.F2 && e.Modifiers == Keys.Alt)
{
// Display a pop-up Help topic to provide additional assistance to the user.
Help.ShowPopup(textBox1, "Enter your first name followed by your last name. Middle name is optional.",
new Point(textBox1.Top, this.textBox1.Left));
}
}
No exemplo acima ele captura o ALT+F1 ou CRTL + F1 ou SHIFT+F1 (ou qualquer outra combinaçao, ex. ALT+SHIFT+F1, etc) e o ALT+F2
Note que é só aplicar logica booleana.. caso voce queira fazer Ctrl+A+1, o codigo fica assim:
if ( e.Control && e.KeyCode=Keys.A && (e.KeyCode=Keys.D1 || e.KeyCode=Keys.NumPad1))
essa parte e.KeyCode=Keys.D1 || e.KeyCode=Keys.NumPad1 é necessaria porque a tecla 1 do teclado acima da tecla Q é diferente da tecla 1 do teclado numerico à direita
fonte:https://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs.aspx?f=255&MSPPError=-2147217396
att
William John Adam Trindade
Analyste-programmeur
Sogi Informatique ltée
If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer". Se achou este post útil, por favor clique em "Votar como útil". Se por acaso respondeu sua dúvida, lembre
de "Marcar como Resposta".