I am trying to capture multiple keydowns in order to execute certain event..
I'm using WPF and C#... I've tried the following to test... it doesn't work, so I am hoping to get some ideas...
private void test(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == System.Windows.Input.Key.H && e.Key == System.Windows.Input.Key.LeftCtrl
&& e.Key == System.Windows.Input.Key.System)
{
MessageBox.Show("Key pressed is: " + e.Key);
}
}
I am basically trying to capture Ctrl+Alt+h..
If nothing else, couldn't you maintain a list/array of the currently pressed keys? You could update the list with handlers for KeyUps and KeyDowns and figure out whether a certain combination of keys was pressed by iterating through the array. I'm not sure if there is built-in functionality to do this, but it would be easy enough to implement.
#If you have any other info about this subject , Please add it free.# |