麻烦高手帮我看看这段代码
- VB code
Private Sub Form_Load()Me.Left = (Screen.Width - Me.Left) / 2Me.Top = (Screen.Height - Me.Height) / 2End SubPrivate Sub Timer1_Timer()If Label1.Left < Me.Width ThenLabel1.Left = Label1.Left + 100ElseIf Label1.Left > -Me.Width ThenLabel1.Left = -Label1.WidthEnd IfIf Label1.ForeColor = &HFF0000 ThenLabel1.ForeColor = &HFF&ElseLabel1.ForeColor = &HFF0000End IfEnd Sub
[解决办法]
- VB code
Option ExplicitDim strA() As StringDim intStart As IntegerPrivate Sub Form_Load() strA() = Split("热,烈,欢,迎,x,y,z,参,观", ",") Timer1.Interval = 1000End SubPrivate Sub Timer1_Timer() Dim intP As Integer Dim strP As String For intP = intStart To UBound(strA) strP = strP & strA(intP) Next intP For intP = 0 To intStart strP = strP & strA(intP) Next intP Label1.Caption = strP intStart = (intStart + 1) Mod (UBound(strA) - LBound(strA) + 1)End Sub