   Managed DirectInput Problems...
  Ok... I've been trying to learn Managed DirectX (using C#) and so far it's been really great.  I just started DirectInput, and I can get it to work, but I can't make it ignore a key being held down.  I have a program setup to change the clear color (background color) when a key is held/pressed (determined by function).  But when I try to make it only change when pressed it won't work.* by pressed I mean press and release is 1... whereas held means every frame it keeps returning true for if the key is down.So, if I haven't confused you all with the question, here is my code.  I can't find out what is wrong with it... I think it *should* work but it doesn't.<source>   ...Device keyboard;bool keypressed = false;List<Key> pressedkeys = new List<Key>();   ...   public bool KeyPressed(Key k, bool repeat)   {  if (keypressed == true)  { if (repeat == true) {foreach (Key current in keyboard.GetPressedKeys()){    if (current == k)    {   keypressed = true;   if (pressedkeys.Contains(k) == false)   {  pressedkeys.Add(k);   }   return true;    }} } else if (repeat == false) {foreach (Key current in keyboard.GetPressedKeys()){    if (current == k)    {   keypressed = true;   if (pressedkeys.Contains(k) == false)   {  pressedkeys.Add(k);   }   return false;    }} }  }  else  { foreach (Key current in keyboard.GetPressedKeys()) {if (current == k){    keypressed = true;    if (pressedkeys.Contains(k) == false)    {   pressedkeys.Add(k);    }    return true;} }  }  if (pressedkeys.Contains(k) == true)  { pressedkeys.Remove(k);  }  if (pressedkeys.Count <= 1) keypressed = false;  return false;   }</source>   