楼主,你所谓的动态显示是什么意思? 是“新浪网络公司”和“http://www.sina.com.cn”反复切换吗? 如果是这样,你可以在窗体上加一个Timer控件,设置它的Interval属性为2000,即两秒变化一次。 然后为Timer控件加入如下代码: Private Sub Timer1_Timer() If Me.Caption = "新浪网络公司" Then Me.Caption = "Http://www.sina.com.cn" Else Me.Caption = "新浪网络公司" End If End Sub
也可以用某个控件的change 和 click 等事件来控制的.具体要看你的实际情况而定.
使用TIMER 控件, Private Sub Timer1_Timer() If Me.Caption = "新浪网络公司" Then Me.Caption = "Http://www.sina.com.cn" Else Me.Caption = "新浪网络公司" End If End Sub
Const TITLE_TEXT As String = "新浪网络公司 http:\\www.sina.com.cn" Private Sub Timer1_Timer() Static i As Long Dim lLen As Long lLen = (i Mod Len(TITLE_TEXT)) + 1 Me.Caption = Left$(TITLE_TEXT, lLen) i = i + 1 End Sub
Option Explicit Dim a() As String Dim b As String Dim J As Integer Private Sub Form_Load()b = "标 题 栏 测 试" a = Split(b, " ")End Sub Private Sub Timer1_Timer() Dim I, K As Integer Dim s As String I = UBound(a) J = J + 1 If J > I + 1 Then J = 1For K = 1 To J s = s & a(K - 1) Next K Me.Caption = s End SubPS:一定给你要显示的字符串中间都加个空格或者其他别的标识符,不然split没法作用
'看这个例子 Option Explicit Dim nStr As Long, tmpStr As String, MyCaption As StringPrivate Sub Form_Load() Me.Caption = "该程序由“天堂小鱼儿”编写" MyCaption = Me.Caption nStr = Len(Me.Caption) tmpStr = "" Timer1.Interval = 800 End SubPrivate Sub Timer1_Timer() tmpStr = tmpStr & Mid(MyCaption, Len(tmpStr) + 1, 1) Me.Caption = tmpStr If Len(tmpStr) = nStr Then tmpStr = "" End Sub
没有必要使用split来解决这个问题……
Private Sub Timer1_Timer() If Len(Form1.Caption) < 100 Then Form1.Caption = " " + Form1.Caption Else Form1.Caption = LTrim(Form1.Caption) End If End Sub
是“新浪网络公司”和“http://www.sina.com.cn”反复切换吗?
如果是这样,你可以在窗体上加一个Timer控件,设置它的Interval属性为2000,即两秒变化一次。
然后为Timer控件加入如下代码:
Private Sub Timer1_Timer()
If Me.Caption = "新浪网络公司" Then
Me.Caption = "Http://www.sina.com.cn"
Else
Me.Caption = "新浪网络公司"
End If
End Sub
Private Sub Timer1_Timer()
If Me.Caption = "新浪网络公司" Then
Me.Caption = "Http://www.sina.com.cn"
Else
Me.Caption = "新浪网络公司"
End If
End Sub
Private Sub Timer1_Timer()
Static i As Long
Dim lLen As Long
lLen = (i Mod Len(TITLE_TEXT)) + 1
Me.Caption = Left$(TITLE_TEXT, lLen)
i = i + 1
End Sub
Dim a() As String
Dim b As String
Dim J As Integer
Private Sub Form_Load()b = "标 题 栏 测 试"
a = Split(b, " ")End Sub
Private Sub Timer1_Timer()
Dim I, K As Integer
Dim s As String
I = UBound(a)
J = J + 1
If J > I + 1 Then J = 1For K = 1 To J
s = s & a(K - 1)
Next K
Me.Caption = s
End SubPS:一定给你要显示的字符串中间都加个空格或者其他别的标识符,不然split没法作用
Option Explicit
Dim nStr As Long, tmpStr As String, MyCaption As StringPrivate Sub Form_Load()
Me.Caption = "该程序由“天堂小鱼儿”编写"
MyCaption = Me.Caption
nStr = Len(Me.Caption)
tmpStr = ""
Timer1.Interval = 800
End SubPrivate Sub Timer1_Timer()
tmpStr = tmpStr & Mid(MyCaption, Len(tmpStr) + 1, 1)
Me.Caption = tmpStr
If Len(tmpStr) = nStr Then tmpStr = ""
End Sub
If Len(Form1.Caption) < 100 Then
Form1.Caption = " " + Form1.Caption
Else
Form1.Caption = LTrim(Form1.Caption)
End If
End Sub