按键 [英] key pressed

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

问题描述

嗨。


我想用esc键取消操作(我也想用C ^ z)。但是,在

取消中,没有转义字符,也没有z。那么,我该如何使用

那些钥匙呢?


谢谢。

解决方案

您好,

检查表单的CancelButton属性是否适合您。


-Benny


Mathieu Chavoutier写道:

嗨。

我想用esc键取消操作(我也想用C ^ Z)。但是,在
取消中,没有转义字符,也没有z。那么,我该怎么做呢?

谢谢。




< blockquote>你好Mathieu,


嗯,有点不清楚你要取消什么样的操作。

你可以使用KeyDown事件并检查转义或CTRL-Z(如果那个

是你所说的C ^ z)就像这样


if(e.KeyCode == Keys.Escape )

//逃脱键击中

if(e.KeyCode == Keys.Z&& e.Control)

//控制关闭时按下z键= CTRL-Z

快乐编码!

Morten Wennevik [C#MVP]


" Morten Wennevik" <莫************ @ hotmail.com>一个écritdansle message de
news:opr7r7oypwhntkfz @ localhost ...嗨Mathieu,
嗯,有点不清楚你要取消什么样的操作。


我知道,但如果我写了太多文字,没有人会读:o)

而且,我必须取消的操作是不同的我在哪里

按下键。

您可以使用KeyDown事件并检查转义或CTRL-Z(如果
是你的那个意思是C ^ z)像这样
如果(e.KeyCode == Keys.Escape)
//逃脱键击中
if(e.KeyCode == Keys.Z&& e.Control)
// z键击中,控件关闭= CTRL-Z




Okey,我在TabPage上寻找它,它不在那里。但是,因为

我也使用面板,它会好的。


非常感谢。


Hi.

I want to use esc key to cancel operations (I also want to use C^z). But, in
"cancel", there is no escape character, and no z. So, how can I do to use
those key ?

Thanks.

解决方案

Hi,
Check if the ''CancelButton'' property of the form will work for you.

-Benny

Mathieu Chavoutier wrote:

Hi.

I want to use esc key to cancel operations (I also want to use C^z). But, in
"cancel", there is no escape character, and no z. So, how can I do to use
those key ?

Thanks.




Hi Mathieu,

Well, it is a bit unclear what kind of operations you want to cancel.
You can use the KeyDown event and check for the escape or CTRL-Z (if that
is what you mean by C^z) like this

if(e.KeyCode == Keys.Escape)
// escape key hit
if(e.KeyCode == Keys.Z && e.Control)
// z key hit while control is down = CTRL-Z
Happy coding!
Morten Wennevik [C# MVP]


"Morten Wennevik" <Mo************@hotmail.com> a écrit dans le message de news:opr7r7oypwhntkfz@localhost... Hi Mathieu, Well, it is a bit unclear what kind of operations you want to cancel.
I know that, but if I write too much text, nobody will read :o)
And, the operation that I have to cancel is different according where I am
where the key is pressed.
You can use the KeyDown event and check for the escape or CTRL-Z (if that is what you mean by C^z) like this
if(e.KeyCode == Keys.Escape)
// escape key hit
if(e.KeyCode == Keys.Z && e.Control)
// z key hit while control is down = CTRL-Z



Okey, I was looking for it on a TabPage, and it was not there. But, because
I also use panels, it will be Ok.

Thank you very much.


这篇关于按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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