当鼠标光标位于其上时,使控制可见 [英] Making a contorl visble when a mouse cursor is on it...................................

查看:79
本文介绍了当鼠标光标位于其上时,使控制可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的疑问很简单,我想在鼠标光标位于控件上时使按钮可见,而当鼠标光标从控件上移开时应该不可见. :doh::confused:
我已经处理了一个称为MouseHover事件的组框事件.当鼠标指针位于其上时,该组框变得可见.但是,当光标从其移开时,即使是可见的.示例代码在这里:-

My doubt is simple i want to make a button visible when mouse cursor is on the control and should be invisible when mouse cursor is moved away from it..???? :doh: :confused:
I have handiled an event of an group box called MouseHover event. The group box is becoming visble when mouse cursor is on it. But, When cursor is moved away from it, then even it is visble. Example code is here:-

private void groupBox2_MouseHover(object sender, EventArgs e)
{
              button10.Visible = true;
}


请帮帮我.预先谢谢您.......................:)


Please help me out. Thank you in advance.................... :)

推荐答案

您在哪里设置了可见性虚假? MouseEnter和MouseLeave事件可能是您正在寻找的事件.悬停仅在鼠标停留在控件上时才会触发,该控件仅告诉您鼠标当前在控件上,而不是在鼠标离开控件时显示.
Where do you ever set the visibility to false? The MouseEnter and MouseLeave events are probably what you''re looking for; Hover only fires when the mouse rests on the control which only tells you the mouse is currently on the control, not when it leaves it.


这篇关于当鼠标光标位于其上时,使控制可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆