Beispiel #1
0
 public HotKeyHandleWindow()
 {
     WindowStyle = WindowStyle.None;
     Width       = 0;
     Height      = 0;
     Loaded     += (s, e) =>
     {
         //这里注册了Ctrl+Alt+1 快捷键
         _hotKeys.Register(new WindowInteropHelper(this).Handle,
                           (int)HotkeyModifiers.Control + (int)HotkeyModifiers.Alt, Keys.D1, CallBack);
     };
 }
Beispiel #2
0
 public static void LoadHotKey()
 {
     //加载热键设置
     HotKeys = HotKeys.Load();
     HotKeys.RegisterError += new EventHandler <HotKeys.RegisterErrorEventArgs>((oo, ee) =>
     {
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         foreach (var exception in ee.Exceptions)
         {
             sb.AppendLine(exception.Message);
         }
     });
     mainWindow.AddLogicToHotKeys(HotKeys);
     HotKeys.Register(mainWindow);
 }
Beispiel #3
0
 public HideForm()
 {
     InitializeComponent();
     SetStyle(ControlStyles.Opaque, true);
     HotKeys.Register(Handle);
 }
 private void RegisterButton_OnClick(object sender, RoutedEventArgs e)
 {
     //这里注册了Ctrl+Alt+E 快捷键
     h.Register(new WindowInteropHelper(this).Handle, (int)HotkeyModifiers.Control + (int)HotkeyModifiers.Alt, Keys.D1, CallBack);
     MessageBox.Show("注册成功");
 }