Search code examples
c#.netwinformspictureboxmousemove

MouseMove event in PictureBox is fired continuously even if the mouse is not moved


Why does MouseMove event of a PictureBox seem to be fired continuously even if the mouse is not moved? I have tried the following codes to prove it (by simply creating a new form with a PictureBox and a Label on it).

private void pictureBox1_MouseMove ( object sender, MouseEventArgs e )
{
  label1.Text = DateTime.Now.ToLongTimeString ( ) + ": " + e.X + "," + e.Y;
}

Solution

  • First guess... either seismic activity or nargles - I suspect nargles :).

    Using the code sample you provided I do not get the same behavior. My label only updates if the mouse is actually moving. (and the pointer has to be over the picturebox to boot).

    But seriously... are there any vibrations on your desk? I might also try another mouse - as the circuitry inside might be sending bad data.