Silverligh 3 Keyboard Events (key combination)

Source: Internet
Author: User
Tags modifiers
Silverlight provides a series of Keyboard Events that allow you to respond to the shortcut key operation. Keyboard Events have many similarities with mouse events, and mouse, focus, and Keyboard Events are sometimes collectively referred to as Silverlight input events.
There are mainly keydown and keyup events.

Pay attention to the following two issues:
1.Keyboard Events and browsers

Different browsers may handle keyboard events in different ways. When you create an application that uses keyboard inputProgramMake sure to test the application in your target browser.
The browser determines that it will be interpreted as the command and the key to be passed to the carried content. This indicates that Keydown And Keyup The event handler function retrieves certain keys. Most of the keys that the browser interprets as commands are shortcut keys or shortcut keys, instead of being passed to Silverlight as key events. For example, CTRL + D is a shortcut key combination used to add a favorite URL to Firefox and Internet Explorer. Neither CTRL nor D is reported as a key event.
2.Keyboard Events and full screen mode
When the Silverlight plug-in is displayed in full screen mode, the keyboard event handler is blocked from passing Keyboard Events to the application. Only the entered keyboard is a set of keys that return the Silverlight plug-in to the embedded mode. Keyboard Input in full screen mode is a security function. The purpose is to minimize the possibility of users entering unexpected information in applications that simulate other applications in an intuitive way. .

 

 

Code
// Single and combination keys
Void Btnedit_keydown ( Object Sender, keyeventargs E)
{
// Processing Business
}

Void Btnedit_keyup ( Object Sender, keyeventargs E)
{
//
If (E. Key = Key. e)
{
If (Keyboard. Modifiers & Modifierkeys. Control) = Modifierkeys. Control)
{
// Business after the CTRL + e event is executed
}
}
}

/*
In the CHM document, this is interpreted as the following information:
Modify key
Some keys are considered as modify keys. These keys are usually pressed together with other keys. The modification keys used on all platforms include shift and CTRL. Some modification keys are platform-specific.
Generally, you need to explain the modification key to check whether a modification key has been pressed when another key event is also received, because the addition of the modification key represents a key combination useful to the application. In this case, the modified key information is not transmitted as part of the event data. You should use the keyboard Utility Class in the event handler to check the modification key as part of the process that may be modified to process the event.
To determine which modification keys are applied, check the modifiers value of the keyboard static class. This property returns the modifierkeys flag enumeration value. This value is a flag because multiple modification keys may be pressed.
The modify key always generates its own key event. You can choose to process these events and track your own modification key status, but it is usually easier to use the modifiers value.
*/

For more information, see: http://msdn.microsoft.com/en-us/cc189015 (zh-CN, vs.95). aspx
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.