I want to detect Alt, or Alt + some key, from within Form1_KeyPress. This is my code:
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (Control.ModifierKeys == Keys.Alt)
{
MessageBox.Show("Alt");
}
if (Control.ModifierKeys == Keys.Control)
{
MessageBox.Show("Control");
}
}
When I hit Ctrl + A for example, the second if triggers. However when I hit Alt + A for example, nothing happens. Why is that? is there some other way to trigger Alt from Form1_KeyPress? I don't want to trigger it from KeyDown in this instance.