keyPress事件与KeyPressEventArgs

it2025-04-09  5

//将输入的小写转换为大写

private void txtstockout_id_KeyPress(object sender, KeyPressEventArgs e) { //将输入的小写转换为大写 if ((int)e.KeyChar >= 97 && (int)e.KeyChar <= 122) { e.KeyChar = (char)((int)e.KeyChar - 32); } }

    ① e.Handled如果处理过事件,则为 true;否则为 false。 

    ②  e.KeyChar   按下(键盘)按钮对应的字符(char)

e.KeyChar用到的键盘对应ASCII码值

   

转载于:https://www.cnblogs.com/lhlong/p/4898325.html

最新回复(0)