怎么用vb中select case语句实现标签沿着窗体内侧的顺时针转动
1个回答
展开全部
Dim Direction As String '方向
Private Sub Form_Load()
Label1.Move 0, 0
Timer1.Interval = 10
Timer1.Enabled = True
Direction = "右"
End Sub
Private Sub Timer1_Timer()
Dim distance As Integer '每次移动距离
distance = 20
Select Case Direction
Case "上"
If Label1.Top < distance Then
Direction = "右"
Else
Label1.Top = Label1.Top - distance
End If
Case "下"
If Label1.Top > Me.ScaleHeight - Label1.Height - distance Then
Direction = "左"
Else
Label1.Top = Label1.Top + distance
End If
Case "左"
If Label1.Left < distance Then
Direction = "上"
Else
Label1.Left = Label1.Left - distance
End If
Case "右"
If Label1.Left > Me.ScaleWidth - Label1.Width - distance Then
Direction = "下"
Else
Label1.Left = Label1.Left + distance
End If
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询