我在 VB.Net 中创建了一个启动画面,并且一切正常,除了我想用多个文本更改加载文本,这些文本在加载过程中每 x 秒更改一次。
例子:Dim LoadingTexts As String = {"charging 1...", "charging 2...", "info1..."}
我不知道我怎么能做到这一点,除了我肯定必须使用计时器......但是怎么做呢?
实际代码:
Public Class frmSplashScreen
Private stringTable() As String = {"Shovelling coal into the server...", "Programming the flux capacitor...", _
"Searching for answer to live, the universe and everything...",
"Waiting for Godot...", "Starting..."}
Private stringMove As Integer = 0
Sub New()
InitializeComponent()
End Sub
Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object)
MyBase.ProcessCommand(cmd, arg)
End Sub
Public Enum SplashScreenCommand
SomeCommandId
End Enum
Public Sub SplashTimer_Tick(sender As Object, e As EventArgs) Handles SplashTimer.Tick
Me.SplashTimer.Enabled = False
Me.labelStarting.Text = stringTable(stringMove)
Me.labelStarting.Refresh()
stringMove += 1
If stringMove < stringTable.Length Then Me.SplashTimer.Enabled = True
End Sub
End Class
谢谢。