Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net framework中的未知messagebox_.net_Vb.net_Winforms - Fatal编程技术网

.net framework中的未知messagebox

.net framework中的未知messagebox,.net,vb.net,winforms,.net,Vb.net,Winforms,在我的vb.net windows应用程序中,我在MouseMove事件中编写了一些代码。 当我的应用程序运行并且光标进入我的应用程序时,会弹出一个messagebox,并在一秒钟内不可见。我无法读取消息框中的内容 谁能帮我摆脱这个不必要的messagebox,它有caption.net framework。 这是我的密码 Public Class ToolDashboard Imports System.Configuration Imports System.Collecti

在我的vb.net windows应用程序中,我在
MouseMove
事件中编写了一些代码。 当我的应用程序运行并且光标进入我的应用程序时,会弹出一个
messagebox
,并在一秒钟内不可见。我无法读取
消息框中的内容

谁能帮我摆脱这个不必要的
messagebox
,它有caption.net framework。 这是我的密码

Public Class ToolDashboard
    Imports System.Configuration
    Imports System.Collections.Specialized
    Public Class CompassToolDashboard
    Dim path As NameValueCollection

        Private Sub ToolDashboard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - (Me.Width - 50), Screen.PrimaryScreen.WorkingArea.Height - Me.Height)
            path = ConfigurationManager.GetSection("ToolPath")
        End Sub

         Private Sub ToolDashboard_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
              Me.BringToFront()
              While Me.Opacity < 1
                 Me.Opacity = Me.Opacity + 0.06
             End While
        End Sub

       Private Sub ToolDashboard_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
             While Me.Opacity > 0
                Me.Opacity = Me.Opacity - 0.001
             End While
       End Sub    
       Private Sub CloseForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseForm.Click, CloseForm.Click
            Process.GetCurrentProcess().Kill()
        End Sub

        Private Sub ShareTool_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VMDashboard.Click
            System.Diagnostics.Process.Start(path("IndexGenerator")) 
        'getting path for Indexgenerator.exe from app.config                 
        'Index generator.exe is present in a remote system      
        End Sub
 End Class
公共类工具仪表板
导入系统配置
导入System.Collections.Specialized
公共类CompassToolDashboard
将路径设置为NameValueCollection
私有子工具dashboard_Load(ByVal sender作为System.Object,ByVal e作为System.EventArgs)处理MyBase.Load
Me.Location=新点(Screen.PrimaryScreen.WorkingArea.Width-(Me.Width-50),Screen.PrimaryScreen.WorkingArea.Height-Me.Height)
path=ConfigurationManager.GetSection(“工具路径”)
端接头
专用子工具Dashboard_MouseEnter(ByVal sender作为对象,ByVal e作为System.EventArgs)处理Me.MouseEnter
Me.BringToFront()
而我。透明度<1
Me.Opacity=Me.Opacity+0.06
结束时
端接头
私有子工具Dashboard_MouseLeave(ByVal sender作为对象,ByVal e作为System.EventArgs)处理Me.MouseLeave
而我。不透明度>0
Me.Opacity=Me.Opacity-0.001
结束时
端接头
私有Sub-CloseForm_Click(ByVal发件人作为System.Object,ByVal e作为System.EventArgs)处理CloseForm。Click,CloseForm。Click
Process.GetCurrentProcess().Kill()
端接头
Private Sub ShareTool_Click(ByVal sender作为System.Object,ByVal e作为System.EventArgs)处理VMDashboard。单击
系统.诊断.过程.启动(路径(“IndexGenerator”))
'正在从app.config获取Indexgenerator.exe的路径
'远程系统中存在Index generator.exe
端接头
末级

我不确定您所说的
消息框
,但是方法
ToolDashboard\u MouseMove
不应该在内部有这个while循环,因为它会使您的应用程序在第一次触发时就卡住,因此它永远不会离开,也永远不会继续使用应用程序。相反,你应该在你想要的特定控件上使用和事件,如果你没有控件,你应该创建一个或类似的控件,用户不会看到,但你可以使用这些事件。

消息框
可能是由于
配置管理器.GetSection
引发的异常造成的。您必须使用断点来验证这一点,或者将IDE配置为在异常发生时自动中断(在Visual Studio 2008中:调试>异常…,在公共语言运行时异常旁边放置一个复选标记)


事件处理程序中的while循环不会像预期的那样执行淡入淡出的动画。您可以使用
计时器执行此操作。另外,如果将
不透明度一直设置为0.0,我相信表单将无法接收
MouseEnter
事件。下面是一个在0.3和1.0之间衰减的示例:

Private WithEvents timer As New Timer()
Private visible As Boolean

Public Sub New()
    InitializeComponent()
    timer.Interval = 1
    Opacity = 0.3
End Sub

Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
    visible = True
    timer.Start()
    MyBase.OnMouseEnter(e)
End Sub

Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
    visible = False
    timer.Start()
    MyBase.OnMouseLeave(e)
End Sub

Private Sub Timer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles timer.Tick
    If (visible) Then
        If (Opacity < 0.94) Then
            Opacity += 0.06
        Else
            Opacity = 1.0
            timer.Stop()
        End If
    Else
        If (Opacity > 0.31) Then
            Opacity -= 0.01
        Else
            Opacity = 0.3
            timer.Stop()
        End If
    End If
End Sub
Private with events timer As New timer()
私有可见为布尔值
公共分新()
初始化组件()
计时器。间隔=1
不透明度=0.3
端接头
MouseCenter上受保护的覆盖子对象(通过值e作为事件参数)
可见=真
timer.Start()
MyBase.onMouseCenter(e)
端接头
在MouseLeave上受保护的覆盖子对象(将值e作为事件参数)
可见=假
timer.Start()
MyBase.OnMouseLeave(e)
端接头
私有子计时器_Tick(ByVal发送方作为对象,ByVal e作为事件参数)处理计时器。Tick
如果(可见),则
如果(不透明度<0.94),则
不透明度+=0.06
其他的
不透明度=1.0
计时器停止()
如果结束
其他的
如果(不透明度>0.31),则
不透明度-=0.01
其他的
不透明度=0.3
计时器停止()
如果结束
如果结束
端接头

您想要实现的目标是什么?我很确定在事件处理程序中使用
While
循环
Application.DoEvents
(特别是像MouseMouve这样经常被激发的东西)不是一个好主意。当光标位于我的应用程序窗体上时,将显示(通过向窗体不透明度添加0.01),否则窗体将不可见(通过从表单不透明度中扣除0.003)…请建议您是否有更好的方法来完成此操作。您确定它是a而不是a或a吗?是的,它是一个MessageBox..您可以发布“MessageBox”的屏幕截图吗?好的。我已经照你说的做了。但是仍然得到了相同的消息框。即使我自己也不确定该消息框是什么,因为它弹出不到一秒钟,并且立即变得不可见。我无法阅读该消息框中的内容。@Learner你能告诉我当你得到消息框时会发生什么情况吗?我已经更新了co正如你所说,de。这个应用程序运行在窗口的右下角。假设应用程序正在运行,我打开了一个excel表,然后这个excel表与我的应用程序窗口重叠。所以下次当我的光标移动到右下角时,我的应用程序工作正常,但会弹出一个未知的消息框,并且不可见我在几分之一秒之内,这非常令人恼火。直到没有窗口与我的应用程序重叠时,消息框才会弹出。请帮助我。如果您需要我这边的更多输入,请告诉我。不幸的是,我不知道这是什么原因…它似乎在您的应用程序之外…如果您的应用程序中有任何位置弹出消息框,禁用它。如果它在你的应用程序之外,我不知道你能做什么