-1

我正在尝试为图片框创建一个 MouseHover 事件,但到目前为止我还没有运气:

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;
}

这里发生了什么?MouseClick 工作正常,也许我必须添加一些东西Form1.Designer.cs

4

1 回答 1

0

好的,我必须在构造函数中添加这一行:this.pictureBox1.MouseHover += new System.EventHandler(this.pictureBox1_MouseHover); 虽然我会使用 mouseenter,但它更快

于 2013-07-26T03:12:32.757 回答