【问题标题】:VISUAL BASIC 6 :: Unload Splash Form With TimerVISUAL BASIC 6 :: 使用计时器卸载飞溅表单
【发布时间】:2017-04-23 08:02:34
【问题描述】:

在我想卸载新生成的表单之前,我的代码都可以正常工作。

我有 2 个计时器 :: 1 个用于加载启动表单,1 个用于卸载启动表单。

Option Explicit

Private frmSplash As Form

Private Sub splashForm()

    Set frmSplash = New myForm

    With frmSplash
        .Width = 4000
        .Height = 3000
        .Caption = "Splash"
    End With

    frmSplash.Show vbModal

    unloadSplash.Enabled = True

End Sub

Private Sub Form_Activate()

    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    splashTimer.Enabled = True

End Sub

Private Sub splashTimer_Timer()

   splashForm

End Sub

Private Sub unloadSplash_Timer()

    'MsgBox "Am I alive ?"

    Unload frmSplash
    Set frmSplash = Nothing

    unloadSplash.Enabled = False
    splashTimer.Enabled = False

End Sub

好像unloadSplash_TimersplashTimer.Enabled = True之后没有启用...

【问题讨论】:

标签: forms function timer vb6 basic


【解决方案1】:

“vbModal”在该命令中停止您的代码。您必须将卸载启动表单的计时器移动到启动表单中。

事件顺序是这样的:

-> sub Form_Activate
-> sub splashTimer_Timer
-> sub splashForm
---> frmSplash.Show vbModal (here the code stop until your form is not unload)
     /* If you close manualy the "frmSplash" the the timer "unloadSplash" start. */

【讨论】:

  • @GoPro 很高兴 :)
【解决方案2】:

您可以在启动表单中移动计时器并从那里执行它,如果您愿意,只有一次。简而言之:

  • 应用程序启动 > 显示初始屏幕
  • 加载时启动画面 > 计时器启动(指定间隔 - 滴答)
  • Timer Tick 事件 > 关闭启动画面 > 加载主窗体。

【讨论】:

    猜你喜欢
    • 2017-09-19
    • 2020-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 2014-01-04
    相关资源
    最近更新 更多