using System.Windows; using System.Windows.Input; namespace XHandler.View.About { /// /// 系统信息页面 /// public partial class SystemInformation : Window { #region 初始化 /// /// 构造函数 /// public SystemInformation() { InitializeComponent(); // 不要忘记这一句! } private void Window_Loaded(object sender, RoutedEventArgs e) { // 你的初始化代码 } private void Window_PreviewKeyDown(object sender, KeyEventArgs e) // 注意参数是 KeyEventArgs { // 处理键盘事件,比如 ESC 键关闭窗口等 if (e.Key == Key.Escape) { this.Close(); } } private void btnClose_Click(object sender, RoutedEventArgs e) { this.Close(); } #endregion } }