[英]button click method doesn't work as it's visibility changes
I have a picturebox(called pic_Image) and 2 buttons(called btn_AddImage & btn_RemoveImage). 我有一个图片框(称为pic_Image)和2个按钮(称为btn_AddImage和btn_RemoveImage)。 I want to make the buttons visible as user moves the mouse on the pic_Image and make them invisibe as mouse leaves the pic_Image. 当用户在pic_Image上移动鼠标时,我想使按钮可见,并在鼠标离开pic_Image时使它们不可见。 this is the code for making visible: 这是使可见的代码:
private void pic_Image_MouseMove(object sender, MouseEventArgs e)
{
btn_AddImage.Visible = true;
btn_RemoveImage.Visible = true;
}
and this is the code for making invisible: 这是使代码不可见的代码:
private void pic_Image_MouseLeave(object sender, EventArgs e)
{
btn_AddImage.Visible = false;
btn_RemoveImage.Visible = false;
}
The problem is that after I use the pic_Image_MouseMove method the Onbutton click method doesn't work. 问题是,在我使用pic_Image_MouseMove方法之后,Onbutton click方法不起作用。
thanks in advance 提前致谢
Mouse movie events continuously fires until mouse is on picture Replace mouse move with mouse enter 鼠标电影事件持续触发,直到鼠标停在图片上为止
private void pic_Image_MouseEnter(object sender, MouseEventArgs e)
{
btn_AddImage.Visible = true;
btn_RemoveImage.Visible = true;
if (pic_Image.Image != null)
btn_RemoveImage.Visible = true;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.