0

我使用 RegisterHotKey 来实现我的想法。它的API如下:

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);

[DllImport("user32.dll")]
static extern bool UnregisterHotKey(IntPtr hWnd, int id);

我的用途在这里:

HotKeys.Regist(Application.Current.MainWindow, HotkeyModifiers.MOD_ALT, Key.D1, () =>
{
    ServiceLocator.Current.GetInstance<MainMaskModel>().RunService.LetMaskUnvisible();
});

当我释放键盘 Alt 或 T 时,我想实现我的另一个函数“LetMaskVisible()”,但我不知道。我应该怎么做?

4

0 回答 0