Beispiel #1
0
        private void MouseHook_MouseAction(object sender, MouseHook.RawMouseEventArgs e)
        {
            Console.WriteLine("mouse act" + e.Message);
            Color clcolor = GetColorAt(e.Point.x, e.Point.y);

            picSelColor.BackColor = clcolor;
            string htmlcol = ColorTranslator.ToHtml(Color.FromArgb(clcolor.ToArgb()));

            txtHtmlColor.Text = htmlcol;
            if (e.Message == MouseHook.MouseMessages.WM_LBUTTONDOWN)
            {
                Console.WriteLine("mouse click " + e.Point.x + ":" + e.Point.y);
                MouseHook.Stop();
                MouseHook.MouseAction -= MouseHook_MouseAction;
                addColor(clcolor);
            }
        }
Beispiel #2
0
 private void btnCapture_Click(object sender, EventArgs e)
 {
     MouseHook.Start();
     MouseHook.MouseAction += MouseHook_MouseAction;
 }