大家好日子我有这个程序,这是一个琐事游戏,我希望通过form.show()和form.hide将表单作为启动画面,我想问问如何我可以通过显示它至少3秒来设置表格并再次隐藏它吗?提前致谢
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
If Label1.Text = "Who invented the airplane?" And TextBox1.Text = "third" Then
Label2.Text = (Label2.Text) + 1
correctmsg.Show()
correctmsg.Hide()
Label1.Text = "Who invented the telephone?"
Return 'Don't do any more checks this time around
ElseIf Label1.Text = "Who invented the airplane?" Then
'Reason ElseIf (In case the question was 'who invented the telephone' then the first errormessage should not not be shown)
wrongmsg.Show()
Return
End If
答案 0 :(得分:2)
试试这个:
Public tTimer As Timer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
tTimer = New Timer()
tTimer.Interval = 3000
tTimer.Enabled = False
AddHandler tTimer.Tick, AddressOf OnLayouttimerTick
End Sub
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
If Label1.Text = "Who invented the airplane?" And TextBox1.Text = "third" Then
Label2.Text = (Label2.Text) + 1
correctmsg.Show()
tTimer.Start()
Label1.Text = "Who invented the telephone?"
Return 'Don't do any more checks this time around
ElseIf Label1.Text = "Who invented the airplane?" Then
'Reason ElseIf (In case the question was 'who invented the telephone' then the first errormessage should not not be shown)
wrongmsg.Show()
Return
End If
Private Sub OnLayouttimerTick(sender As Object, e As EventArgs)
correctmsg.Hide()
End Sub
答案 1 :(得分:1)
如果您不希望GUI执行任何其他操作,则可以使用Thread.sleep(3000)
。如果您希望在显示此correctmsg
表单时GUI正常运行,请使用以下代码
correctmsg.Show()
Dim SW2 As New Stopwatch
SW2.Start()
Do
Application.DoEvents()
Loop Until SW2.ElapsedMilliseconds >= 3000m
correctmsg.Hide()
答案 2 :(得分:1)
将计时器timer1
放在splashscreenFORM
上,将其设置为enabled=false
双击timer1
将此代码放在me.close()
现在从您想要这样做的形式
dim mysplash as new splashscreenFORM
mysplash.timer1.Interval = 3000
mysplash.timer1.start()
mysplash.show()
飞溅形状应该出现3秒