Winforms Hotkey, Help?

Posted by Di4g0n4leye on Stack Overflow See other posts from Stack Overflow or by Di4g0n4leye
Published on 2010-03-19T02:13:06Z Indexed on 2010/03/19 9:11 UTC
Read the original article Hit count: 443

Filed under:
|
|
namespace WebBrowser
    {
     public partial class MainForm : Form
     {
      public MainForm()
      {
      InitializeComponent();
      }
      int GetPixel(int x, int y)
      {
       Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppPArgb);
       Graphics grp = Graphics.FromImage(bmp);
       grp.CopyFromScreen(new Point(x,y), Point.Empty, new Size(1,1));
       grp.Save();
       return bmp.GetPixel(0, 0).ToArgb();
      }
      void Button1Click(object sender, EventArgs e)
      {
       int x = Cursor.Position.X;
       int y = Cursor.Position.Y;
       int pixel = GetPixel(x,y);
       textBox1.Text = pixel.ToString();
      }
      void MainFormLoad(object sender, EventArgs e)
      {
      webBrowser1.Navigate("http://google.com");
      }
      }
      }

     }

i want to add a hotkey that call Button1 on Press, How can that be done?

© Stack Overflow or respective owner

Related posts about c#

Related posts about webbrowser