创建动画的窗体标题

whjava 2003-05-09 08:16:59
如上
...全文
72 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Me.Caption = Right$(Me.Caption, Len(Me.Caption) - 1) & Left$(Me.Caption, 1)
这条语句经典!
回复
wu_yongcai 2003-05-09
up
回复
LoveBH 2003-05-09
Dim a As String

Private Sub Form_Load()
Me.Caption = "有动画效果的窗体标题"
'将窗体标题存放在变量a中,以供各过程使用
a = Form1.Caption
'将两个定时器置为无效
Timer1.Enabled = False
Timer2.Enabled = False
End Sub

Private Sub Command1_Click()
Timer1.Interval = 100
Timer2.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Me.Caption = Space(15) & a '在窗体标题前加20个空格
Timer2.Interval = 100
Timer1.Enabled = False
Timer2.Enabled = True
End Sub


Private Sub Timer1_Timer()
Dim t As String
Static i As Integer
'取得窗体标题的前i个字符
t = Left(a, i)
'重新设置窗体的标题
Form1.Caption = t
i = i + 1
'如果窗体标题已显示完毕,则重新逐个显示字符
If i > Len(a) Then i = 0
End Sub



Private Sub Timer2_Timer()
'产生标题循环滚动效果
Me.Caption = Right$(Me.Caption, Len(Me.Caption) - 1) & Left$(Me.Caption, 1)
End Sub

回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7491

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-09 08:16
社区公告
暂无公告