如何检测按键被按下并处理

如何检测按键被按下并处理

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

问题描述

限时删除!!

大家好,我是这个论坛的新手,我控制一个键有问题。



我想解决的问题是:



1)假设我们在c#应用程序中有一个表单并有一个标签。



2)I想使用箭头键来改变标签。但我想要的重要的是,如果我按下键并处理它,标签必须显示指定的文本,而我一直按下键。如果我按下并立即将其取回,标签文本必须返回其原始状态。



3)这只是一个问题的证明。我想在其他应用程序中使用此属性,在此之前,我必须知道并且可以正确使用该属性。



提前感谢..



我尝试过:



我试图使用KeyDown,KeyPress和KeyUp事件,但我不能采取我想要的。一旦我按下键并保持该状态,情况就是一样。但是,我按下后退,标签不会改变(如果我不按键,我希望标签返回其原始状态)。

Hello everyone, I am new at this forum and i have a problem by controlling a key.

The problem that i want to solve is that way :

1) Let's say we have a form in c# application and have a label.

2) I want to use arrow keys to change tha label. But the important thing that i want is,if i press the key and handle it, the label must show the specified text while i keep pressing the key. If i press and take it back immidiately, the label text must return its original state.

3) This is just a demonstration of a problem. I want to use this property in other application , before doing that, i have to know and can use the property in proper way.

Thanks in advance..

What I have tried:

I tried to use KeyDown, KeyPress and KeyUp events but i couldn't take what i want. Once i press the key and keep it that state, the situation is same.However, i take the pressing back ,the label does not change (I want the label to return its original state if i don't keep pressing the key).

推荐答案




这篇关于如何检测按键被按下并处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:08