我想在VB中弄一个LABEL,这个LABEL可以在窗体里面不停从下到上移动,有高手知道怎么弄么?小弟求
2个回答
展开全部
'在窗体Form1上面放上一个Picture1,picture1上面放上一个Label1,在窗体上再放上一个计时器Timer1
Private Sub Form_Load()
Label1.AutoSize = True
Label1.Caption = "2008年奥运会即将来临!"
Timer1.Enabled = True
Timer1.Interval = 10 '调整这个值可控制标签label1的移动速度
Picture1.ScaleMode = 3
Me.ScaleMode = 3
End Sub
Private Sub Timer1_Timer()
If Label1.Top <= 0 - Label1.Top Then Label1.Top = Picture1.ScaleHeight
Label1.Top = Label1.Top - 1
End Sub
Private Sub Form_Load()
Label1.AutoSize = True
Label1.Caption = "2008年奥运会即将来临!"
Timer1.Enabled = True
Timer1.Interval = 10 '调整这个值可控制标签label1的移动速度
Picture1.ScaleMode = 3
Me.ScaleMode = 3
End Sub
Private Sub Timer1_Timer()
If Label1.Top <= 0 - Label1.Top Then Label1.Top = Picture1.ScaleHeight
Label1.Top = Label1.Top - 1
End Sub
展开全部
Dim b As Boolean
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Do While Label1.Top > 0
If Label1.Top <= 100 Then Label1.Top = Me.ScaleHeight
Sleep 1000
Label1.Top = Label1.Top - 100
DoEvents
If b Then Exit Do
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
b = True
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Do While Label1.Top > 0
If Label1.Top <= 100 Then Label1.Top = Me.ScaleHeight
Sleep 1000
Label1.Top = Label1.Top - 100
DoEvents
If b Then Exit Do
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
b = True
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询