How can I exit the window while press the Esc key
2011-10-30 08:33
246 查看
When I on the windows page I want to exit this window,how can I do it in code.
The following code do that as example.
The following code do that as example.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace ?????.Views.Configuration { /// <summary> /// Interaction logic for About.xaml /// </summary> public partial class About : Window { public About() { InitializeComponent(); PreviewKeyDown += new KeyEventHandler(CloseOnEscape); } private void CloseOnEscape(object sender, KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Escape) Close(); } } }
相关文章推荐
- How can selenium web driver get to know when the new window has opened and then resume its execution
- line 1 of the inf file winnt.xpe is invalid setup cannot continue. press any key to exit
- Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
- How can I disable the User Account Control (UAC) feature on my Windows Vista computer?
- How can we identify the weights of different models for ensemble?
- 非NSResponder类捕捉按键消息[How to capture ESC key in a Cocoa application]
- Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
- How Can I Minimize a VI to an Icon on the Windows System Tray?
- Errors while building APK. You can find the errors in the 'Messages' view.
- [BetterExplained]How can we add the numbers from 1 to 100?
- How can I insert a checkbox into the header of my view?
- How to limit an array of similar hashes to those that have more than one of the same key:value pair
- How You Can Cash In On The Green Gold Rush of 2014
- How to get the DOM of a WebBrowser control from a window handle (VB6)
- how can i print the data in DataGrid?
- how websites are perceived by their visitors and the basic ways in which websites can be constructed.
- An Introduction to the CAN Bus: How to Programmatically Control a Car
- How can I get the request URL from a Java Filter?
- How can I restore the MySQL root user’s full privileges?
- How to make an SDL window the child of another window in Win32