Domanda

I am trying to create a MouseHover event for a pictureBox, but I have had no luck so far:

private void pictureBox1_MouseHover(object sender, EventArgs e)
{
  pictureBox1.Image = ArgyroCinema.Properties.Resources.ktz00h07;
  label1.Text = "hover";
}

private void pictureBox1_Click(object sender, EventArgs e)
{
  pictureBox1.Image = ArgyroCinema.Properties.Resources.ktz00h07;
}

private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
  pictureBox1.Image = ArgyroCinema.Properties.Resources.ktz00h07;
}

What is going on here? MouseClick works correctly, maybe I have to add something on Form1.Designer.cs ?

È stato utile?

Soluzione

ok i had to add this line on the constructor: this.pictureBox1.MouseHover += new System.EventHandler(this.pictureBox1_MouseHover); although i will use mouseenter, its faster

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top