VISUAL BASIC 6 :: 使用计时器卸载飞溅形式
VISUAL BASIC 6 :: Unload Splash Form With Timer
在我要卸载新生成的表单之前,我的代码工作正常。
我有 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_Timer
在 splashTimer.Enabled = True
之后未启用...
"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. */
您可以将计时器移动到启动画面中并从那里开始执行,如果您愿意,可以只计时一次。所以简而言之 shell:
- 应用程序启动 > 显示启动画面
- 加载启动画面 > 计时器开始(指定的时间间隔 - 滴答)
- Timer Tick 事件 > 关闭初始屏幕 > 加载主窗体。
在我要卸载新生成的表单之前,我的代码工作正常。
我有 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_Timer
在 splashTimer.Enabled = True
之后未启用...
"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. */
您可以将计时器移动到启动画面中并从那里开始执行,如果您愿意,可以只计时一次。所以简而言之 shell:
- 应用程序启动 > 显示启动画面
- 加载启动画面 > 计时器开始(指定的时间间隔 - 滴答)
- Timer Tick 事件 > 关闭初始屏幕 > 加载主窗体。