当鼠标悬停在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