当没有按下时,Read.Key读取一个键 [英] Read.Key reads a key when none is pressed

查看:65
本文介绍了当没有按下时,Read.Key读取一个键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码试图学习如何使用read.key方法:

I''ve got the following code trying to learn how to use the read.key method:

展开 | 选择 | Wrap | 行号

推荐答案

如果断开键盘会发生什么?
What happens if you disconnect your keyboard?


你可以将 keypress.KeyChar 强制转换为int来查看按下的键的代码,也许这有助于弄清楚,哪个键显然是按下的。
You could cast keypress.KeyChar to an int to see the code of the pressed key, maybe this helps figuring out, which key is apparently pressed.


或者更好地使用 keypress.Key 来查看该键的文本表示。
Or better to use keypress.Key to see the textual representation of that key.


这篇关于当没有按下时,Read.Key读取一个键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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