title: C# Keys Enumeration Confused: Keys.Alt or Keys.RButton | Keys.ShiftKey | Keys.Alt
body: <p>I was trying to test whether the Alt key was pressed.</p>
  
  <p>I had a check similar to:</p>
  
  <pre><code>private void ProcessCmdKey(Keys keyData)
  {
   if (keyData == Keys.Alt)
   {
    System.Console.WriteLine ("Alt Key Pressed");
   } 
  }
  </code></pre>
  
  <p>Anyways needless to say when I breakpointed when I had pressed the Alt key the debugger told me the key that was pressed was actually Keys.RButton | Keys.ShiftKey | Keys.Alt</p>
  
  <p>Can anyone shed some light on what is going on or perhaps point me to an article that can explain?</p>
  
  <p>Thanks
  FZ</p>
  
  <p>Edit:
  I am still a bit lost as to why the ENUM would have have other bit values set and not simply the Alt key? I understand that the enum can include more than 1 state with the flags attrivbute but I am not sure why it does if all I pressed was Alt? </p>