当鼠标移动到窗体的控件上时,表单会隐藏并持续显示 [英] Form hides and is seen continuously when mouse is moved over form's controls

查看:62
本文介绍了当鼠标移动到窗体的控件上时,表单会隐藏并持续显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在控件的鼠标悬停上显示一个表单。我在表单上有很少的控件,如标签,图片框和文本框。我想在表单的鼠标离开事件中隐藏表单,我已经编写了函数将表单隐藏在表单'鼠标左键上。但是当看到表单时,如果我将鼠标从一个控件移动到另一个控件,表单会隐藏并再次显示。它会给表单带来闪烁效果。

如何解决它。

解决方案

用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


这篇关于当鼠标移动到窗体的控件上时,表单会隐藏并持续显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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