Winform Splash Screen – VB.NET – Timer

我在应用程序和表单上有一个闪屏.我有一个计时器.
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提供的内置Splash Screen:

转到“Projects”菜单并选择“Add Windows Form”并选择Splash Screen模板:

然后在Project的应用程序设置中,选择该表单作为Splash屏幕:

您的启动表单应该是您的登录表单,而不是启动屏幕表单.

更新:

单击“我的项目”应用程序屏幕中最后一个图像上的“查看应用程序事件”按钮,并添加代码以设置MinimumSplashScreenDisplayTime值:

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秒.

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...