advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the source code for the Keystroke Sandbox application.
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Exploring Secrets of .NET Keystroke Handling

If you've ever been frustrated trying to figure out how to intercept or assign specific keystrokes to specific controls, you'll be glad you found this article. 


advertisement
ew areas in .NET are seemingly as simple yet deceptively challenging as processing keyboard inputs. This situation is exacerbated because neither the MSDN documentation nor any of the excellent .NET support websites provide comprehensive, practical details about handling keystrokes. Enter Keystroke Sandbox, a small application developed just for this article. Keystroke Sandbox shows you graphically what happens when you press a single key or a combination of keys. Furthermore, it lets you customize its environment at runtime to emulate a variety of the most common Windows Forms application patterns, including both enabling/disabling controls to receive or ignore input as well as simulating consuming keystrokes at different stages and using different controls.

This article covers the different types of keyboard interaction that an application may have. You'll see how you can simplify debugging by observing which methods get invoked on which controls when you press a key. The article concludes with a practical guide for implementing a variety of common key-handling scenarios.

What You Need
  • Visual Studio 2008
  • C# 3.0
  • .NET Framework: 2.0 or higher
<

It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement