我的应用程序和该表单上有一个启动屏幕。我有一个计时器。
Private Sub Splash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SplashTimer.Start()
' Set application title
' Set Version
Me.Show()
'Me.Refresh()
'System.Threading.Thread.Sleep(2000)
'Login.ShowDialog()
'Login.AllowTransparency = True
End Sub
计时器的间隔设置为 5000。
Private Sub SplashTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SplashTimer.Tick
SplashTimer.Stop()
Login.Show()
Login.AllowTransparency = True
Me.Hide()
End Sub
我这里设置了断点,但是好像没有碰到这个断点。我取消注释 Me.Refresh()
启动画面正在关闭。然后显示登录并带有继续按钮。当您点击继续时
按钮
MainMenu.Show() 'this form should be shown as this is the main window of the application but it's not showing.
Me.Close() 'closes login window
没有窗口显示并且应用程序挂起。
任何意见将不胜感激。
我建议使用 Visual Studio 提供的内置启动屏幕:
转到“项目”菜单并选择“添加 Windows 窗体”,然后选择启动屏幕模板:
![enter image description here](https://i.stack.imgur.com/YGCVU.png)
然后在项目的应用程序设置中,选择该窗体作为启动屏幕:
![enter image description here](https://i.stack.imgur.com/TIfut.png)
您的启动表单应该是登录表单,而不是启动屏幕表单。
Update:
单击“我的项目的应用程序”屏幕中最后一个图像上的“查看应用程序事件”按钮,然后添加此代码以设置最小启动画面显示时间 value:
Imports System.Collections.ObjectModel
Namespace My
Partial Friend Class MyApplication
Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean
Me.MinimumSplashScreenDisplayTime = 5000
Return MyBase.OnInitialize(commandLineArgs)
End Function
End Class
End Namespace
您的启动画面将在屏幕上保留 5000 毫秒,即 5 秒。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)