当鼠标悬停在winform c#.net中的按钮上时如何执行操作? [英] How to perform action when mouse hovers over a button in winform c#.net?
本文介绍了当鼠标悬停在winform c#.net中的按钮上时如何执行操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i有winform c#2012
我的winform上我放了3个按钮(btn1,btn2,btn3)。
现在
我想要做的是:当鼠标悬停在按钮1btn1上时,剩下的按钮(btn2,btn3)出现
我该怎么办?
我尝试了什么:
i只需拖放Visual Studio工具箱中的3个按钮
hi all,
i have winform c# 2012
on my winform i put 3 buttons(btn1,btn2,btn3).
now what i want to do is: when mouse hovers over the button 1"btn1", then the rest of buttons (btn2,btn3) appears
how can i do it?
What I have tried:
i just drag and drop the 3 butttons from toolbox of Visual studio
推荐答案
你可以处理这两个事件:
Control.MouseEnter Event(System.Windows.Forms) [ ^ ],>
Control.MouseLeave Event (System.Windows.Forms) [ ^ ]。
在Forms中称为悬停的替代行为是不同的:当鼠标光标在控制区域内停留一段时间时调用它。我会避免使用它,因为用户的感觉不确定,但如果你想要这个,你可以处理 Control.MouseHover事件(System.Windows.Forms) [ ^ ]。
-SA
You can handle these two events:
Control.MouseEnter Event (System.Windows.Forms)[^],
Control.MouseLeave Event (System.Windows.Forms)[^].
Alternative behavior called "hovering" in Forms is different: it is invoked when a mouse cursor rests inside the control area for certain period of time. I would avoid using it, due to this uncertainty to the user's feeling, but if you want this, you can handle Control.MouseHover Event (System.Windows.Forms)[^].
—SA
这篇关于当鼠标悬停在winform c#.net中的按钮上时如何执行操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文