nativewin32.cs

来自「C#自定义查询控件」· CS 代码 · 共 34 行

CS
34
字号
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace CommonComponent.CommonQuery
{
	/// <summary>
	/// Register Hot Key
	/// </summary>
	public sealed class NativeWin32
	{
		[DllImport("user32.dll", SetLastError=true)] 
		public static extern bool RegisterHotKey( IntPtr hWnd, // handle to window 
			int id, // hot key identifier 
			KeyModifiers fsModifiers, // key-modifier options 
			Keys vk // virtual-key code 
			);

		[DllImport("user32.dll", SetLastError=true)] 
		public static extern bool UnregisterHotKey( IntPtr hWnd, // handle to window 
			int id // hot key identifier 
			); 

		[Flags()]
		public enum KeyModifiers
		{
			None = 0, 
			Alt = 1, 
			Control = 2, 
			Shift = 4
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?