本文介绍了即使表单是hide或visible = false,也可以使用鼠标悬停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi, I´m trying to implement AutoHide function to my C# winForm appBar for more then a week and I still dont have a solution. Now I have an idea how to do it diffrent then via SHAppBarMessage (cause I don´t know how to use it for autohide), but I´m looking for a way how to get if mouse is hover the form even if form is visible = false or hide(). Do anyone please know some example? Thank you very much, Blaato.
我尝试过:
我什么也没做,因为我什么都不知道。
What I have tried:
I´m trying nothing, cause I don´t have any idea.
推荐答案
protected override void OnMouseMove(MouseEventArgs e)
{
if (button1.ClientRectangle.Contains(e.Location))
{
button1.Visible=true;
}
else
{
button1.Visible=false;
}
base.OnMouseMove(e);
}
在我的样本中,我使用了一个Button来显示和测试效果。您只需将button1替换为您的控件...
In my Sample I used a Button to Show and test the effect. You only have to replace 'button1' with your Control ...
这篇关于即使表单是hide或visible = false,也可以使用鼠标悬停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!