//将输入的小写转换为大写
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)