且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当鼠标移动到窗体的控件上时,表单会隐藏并持续显示

更新时间:2023-12-06 08:30:16

用2表格创建新项目





Form1 with commandbutton(Button1)



  Public   Form1 

私有 Sub Button1_Click(发件人作为系统。对象,e As System.EventArgs)句柄 Button1.Click
Form2.Show()
结束 Sub

结束





-



Form2有多种控制权..



当没有激活​​/鼠标离开其他形式时,表格2将自动关闭



 私人  Sub  Form2_Deactivate(发件人作为 对象,e  As  System.EventArgs)句柄  .Deactivate 
Me .Hide()
End Sub

私有 Sub Form2 _LostFocus(发件人作为 对象,e 作为 System.EventArgs)句柄 .LostFocus
。隐藏()
结束 Sub


I am showing a form on a control''s mouseover.I have few controls like label,picturebox and textbox on the form.I want to hide the form on form''s mouse leave event and I have written the function to hide the form on form''s mouse leave.But when the form is seen and if I move the mouse from one control to other,the form hides and is seen again.It gives a flashing effect of the form.
How to resolve it.

create new project with 2 form


Form1 with commandbutton (Button1)

Public Class Form1

   Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Form2.Show()
    End Sub

End Class



--

Form2 with many control..

Form 2 will automaticly closed when inacktivated/mouse leave to other form

Private Sub Form2_Deactivate(sender As Object, e As System.EventArgs) Handles Me.Deactivate
    Me.Hide()
End Sub

Private Sub Form2_LostFocus(sender As Object, e As System.EventArgs) Handles Me.LostFocus
    Me.Hide()
End Sub