| |

VerySource

 Forgot password?
 Register
Search
View: 768|Reply: 3

How do I make an application respond to keyboard events?

[Copy link]

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-10 16:00:01
| Show all posts |Read mode
Such as:
When you press the space bar, the program behaves.
How to achieve it? Thank you!
Reply

Use magic Report

0

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 Hong Kong

Post time: 2020-1-13 19:45:01
| Show all posts
winfrom:
 private void textBox_BarcodeEntry_KeyUp (object sender, KeyEventArgs e)
        {
                switch (e.KeyCode)
                {
                    case Keys.Sapce:
                     break;

                }
            
         }
webfrom:
<script language = "javascript">
function document.onkeypress ()
{
if (window.event.keyCode == 13)
 {
            // 13 is the enter key
         }
}
</ script>
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-14 15:18:01
| Show all posts
javascript can achieve
If it should be a program, then it goes without saying that it has its own keyboard events.
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-14 16:18:01
| Show all posts
No, the program didn't respond.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list