vb中label中的文字如何移动
DimflagAsIntegerPrivateSubForm_Load()flag=0EndSubPrivateSubCommand1_Click()IfCommand1...
Dim flag As Integer
Private Sub Form_Load()
flag = 0
End Sub
Private Sub Command1_Click()
If Command1.Caption = "移动" Then
Command1.Caption = "暂停"
Timer1.Enabled = False
Else
Command1.Caption = "移动"
Timer1.Enabled = ture
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Timer1_Timer()
Select Case flag
Case Is = 0
' Label1.Left = Label1.Left - 100
If Label1.Left + Label1.Width = Form1.Width Then flag = 1
Case Is = 1
' Label1.Left = Label1.Left + 100
If Label1.Left = 0 Then flag = 0
End Select
End Sub 展开
Private Sub Form_Load()
flag = 0
End Sub
Private Sub Command1_Click()
If Command1.Caption = "移动" Then
Command1.Caption = "暂停"
Timer1.Enabled = False
Else
Command1.Caption = "移动"
Timer1.Enabled = ture
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Timer1_Timer()
Select Case flag
Case Is = 0
' Label1.Left = Label1.Left - 100
If Label1.Left + Label1.Width = Form1.Width Then flag = 1
Case Is = 1
' Label1.Left = Label1.Left + 100
If Label1.Left = 0 Then flag = 0
End Select
End Sub 展开
1个回答
展开全部
Private Sub Timer1_Timer()
Select Case flag
Case Is = 0
Label1.Left = Label1.Left + 100
If Label1.Left + Label1.Width >= Form1.Width Then flag = 1 '不太可能恰好等于
Case Is = 1
Label1.Left = Label1.Left - 100
If Label1.Left <= 0 Then flag = 0 ‘不太可能恰好等于,所以用<=
End Select
End Sub
Select Case flag
Case Is = 0
Label1.Left = Label1.Left + 100
If Label1.Left + Label1.Width >= Form1.Width Then flag = 1 '不太可能恰好等于
Case Is = 1
Label1.Left = Label1.Left - 100
If Label1.Left <= 0 Then flag = 0 ‘不太可能恰好等于,所以用<=
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询