public Form1() { InitializeComponent(); colorProps = new ColorProperties(); Load += (sender, args) => { txtHexadecimal.DataBindings.Add("Text", colorProps, "ActualColorHex"); txtARBG.DataBindings.Add("Text", colorProps, "ActualColorRGB"); txtColorDiff.DataBindings.Add("Text", colorProps, "ActualColorDiff"); panel2.DataBindings.Add("BackColor", colorProps, "ActualColor"); Location = new Point(SystemInformation.WorkingArea.Width - Width - 20, SystemInformation.WorkingArea.Height - Height - 50); HookManager.MouseMove += HookManagerMouseMove; hook = KeyboardHooks.Create(); hook.KeyPressed += HandleHootkey; hook.RegisterHotKey(ColorFinder.ModifierKeys.Control, Keys.D); hook.RegisterHotKey(ColorFinder.ModifierKeys.Control | ColorFinder.ModifierKeys.Shift, Keys.D); }; Application.ApplicationExit += (sender, args) => { hook.Dispose(); try { niColorFinder.Visible = false; niColorFinder.Dispose(); } catch (Exception) { niColorFinder = null; } }; }
private void BindHotKey() { hook = KeyboardHooks.Create(); hook.KeyPressed += hook_KeyPressed; hook.RegisterHotKey(options.ShortcutModifiers, options.ShortcutKey); }