如何在C#程序中获取Enter键的ascii值 [英] how to get the ascii value of enter key in c# program

查看:411
本文介绍了如何在C#程序中获取Enter键的ascii值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从e.keychar获取回车键的ascii值


thanq

解决方案

  int   value  =( int )e.KeyChar; 


只需将其转换为:

  char  c =( char )e.KeyChar;


这里是一个例子
KeyChar属性

i want to get the ascii value of the enter key from e.keychar


thanq

解决方案

int value = (int)e.KeyChar;


Just cast it to a char :

char c = (char)e.KeyChar;


Here is an Example
KeyChar Property


这篇关于如何在C#程序中获取Enter键的ascii值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆