示例#1
0
        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;
                }
            };
        }
示例#2
0
        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;
                }
            };
        }
示例#3
0
 private void BindHotKey()
 {
     hook = KeyboardHooks.Create();
     hook.KeyPressed += hook_KeyPressed;
     hook.RegisterHotKey(options.ShortcutModifiers, options.ShortcutKey);
 }
示例#4
0
 private void BindHotKey()
 {
     hook             = KeyboardHooks.Create();
     hook.KeyPressed += hook_KeyPressed;
     hook.RegisterHotKey(options.ShortcutModifiers, options.ShortcutKey);
 }