加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Winform Splash Screen – VB.NET – Timer

发布时间:2020-12-17 00:20:37 所属栏目:大数据 来源:网络整理
导读:我在应用程序和表单上有一个闪屏.我有一个计时器. 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.
我在应用程序和表单上有一个闪屏.我有一个计时器.
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秒.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读