How to obtain mouse coordinates in form webbrowser in c sharp

  • 2020-04-02 01:21:27
  • OfStack

< img Alt = "" border = 0 SRC =" / / files.jb51.net/file_images/article/201307/201307311022319.jpg ">

As shown in the figure, it is necessary to insert a control of time, so that the coordinate value will keep changing according to the mouse movement. Write in the time plug-in

private void timer1_Tick(object sender, EventArgs e)
        {
            if (webBrowser1.Bounds.Contains(this.PointToClient(Cursor.Position)))
            {

                this.toolStripStatusLabel1.Text = webBrowser1.PointToClient(Cursor.Position).ToString();
            }
        }
    }

This is implemented in webbrowser.
Remember in form_load, add timer1.start (); So it will start!

Related articles: