Check if Keys is Letter/Digit/Special Symbol

后端 未结 6 2047
时光取名叫无心
时光取名叫无心 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 18:57

    I have tried the following code but for some reason char.IsLetter() method is recognising the following keys as Letters???

    F1, F8, F9, F11, F12, RightShift, LeftShift, RightAlt, RightCtrl, LeftCtrl, LeftWin, RightWin, NumLock.

    This method doesn't seem to be that full proof regarding what it thinks is a letter.

    if(char.IsLetter((char)e.Key) || char.IsDigit((char)e.Key))
    

提交回复
热议问题