Check if Keys is Letter/Digit/Special Symbol

后端 未结 6 2016
时光取名叫无心
时光取名叫无心 2021-01-02 18:45

I override ProcessCmdKey and when I get Keys argument, I want to check if this Keys is Letter or Digit or Special Symbol.

I ha

6条回答
  •  清酒与你
    2021-01-02 19:07

    Try

    if( !(keyData >= Keys.F1 && keyData <= Keys.F12))
    {
        char key = (char)keyData;
        if(char.IsLetterOrDigit(key))
        {
            Console.WriteLine(key);
            return false;
        }
    
    }
    return base.ProcessCmdKey(ref msg, keyData);
    

提交回复
热议问题