我做了Label1控件的caption属性的字符串移动的方法全部读取的过程, 问题是caption的字符串较少的时候都可以。但是过多时,其后的部分不能显示出来了 caption的字符串能允许多少字符串呢   什么方法能够解决呢

解决方案 »

  1.   

    Dim j As LongPrivate Sub Command1_Click()
        Dim i As Long
        
        For i = 1 To 1000
            Text1.Text = Text1.Text & i & "aaaaaaaaaabbbbbbbbbb"
        Next i
        
        
        Label1.BackStyle = 0 '透明标签
        Label1.AutoSize = True
        Label2.BackStyle = 0 '透明标签
        Label2.AutoSize = True
    '    Picture1.ScaleMode = 3 '象素座标
    '    Me.ScaleMode = 3
        Label1.Caption = Mid(Text1.Text, j + 1, 200)
        j = j + 200
         Label2.Caption = Mid(Text1.Text, j + 1, 200)
        Label2.Left = Label1.Left + Label1.Width
        
        Timer1.Enabled = True
    End SubPrivate Sub Timer1_Timer()
        
        Label1.Left = Label1.Left - 2000
        Label2.Left = Label2.Left - 2000
        
        If Label1.Left + Label1.Width < 0 Then
            Label1.Left = Label2.Left + Label2.Width
            
            If j + 200 >= Len(Text1.Text) Then
                Label1.Caption = Mid(Text1.Text, j + 1, 200) & Left(Text1.Text, 200 - (Len(Text1.Text) - j))
                j = 200 - (Len(Text1.Text) - j)
            Else
                Label1.Caption = Mid(Text1.Text, j + 1, 200)
                j = j + 200
            End If
        End If
        
        If Label2.Left + Label2.Width < 0 Then
            Label2.Left = Label1.Left + Label1.Width
            
            If j + 200 >= Len(Text1.Text) Then
                Label2.Caption = Mid(Text1.Text, j + 1, 200) & Left(Text1.Text, 200 - (Len(Text1.Text) - j))
                j = 200 - (Len(Text1.Text) - j)
            Else
                Label2.Caption = Mid(Text1.Text, j + 1, 200)
                j = j + 200
            End If
        End If
        
        End Sub