vb控件用计时器设置图标左右移动,求解
请不要那代码来敷衍,不好意思,说话就这么直白!我需要的是步骤,第一步怎么设置这个代码,什么意思。这样。是一个计时器,一个image.command的控件弄得,麻烦了!让I...
请不要那代码来敷衍,不好意思,说话就这么直白!
我需要的是步骤,第一步怎么设置这个代码,什么意思。
这样。是一个计时器,一个image.command的控件弄得,
麻烦了!让IMAGE图片左右移动。数值弄整数好理解。
我错了,以后一定认真上课,唉。。悲剧啊!
忘了,还有一个结束控件。嘿嘿。糊涂了! 展开
我需要的是步骤,第一步怎么设置这个代码,什么意思。
这样。是一个计时器,一个image.command的控件弄得,
麻烦了!让IMAGE图片左右移动。数值弄整数好理解。
我错了,以后一定认真上课,唉。。悲剧啊!
忘了,还有一个结束控件。嘿嘿。糊涂了! 展开
展开全部
Dim S As String
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
Image1.Left = 0
S = "右移"
End Sub
Private Sub Timer1_Timer()
If S = "右移" Then
If Image1.Left + Image1.Width <= Me.Width Then Image1.Left = Image1.Left + 20
If Image1.Left + Image1.Width >= Me.Width Then S = "左移"
ElseIf S = "左移" Then
If Image1.Left >= 0 Then Image1.Left = Image1.Left - 20
If Image1.Left <= 0 Then S = "右移"
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
Image1.Left = 0
S = "右移"
End Sub
Private Sub Timer1_Timer()
If S = "右移" Then
If Image1.Left + Image1.Width <= Me.Width Then Image1.Left = Image1.Left + 20
If Image1.Left + Image1.Width >= Me.Width Then S = "左移"
ElseIf S = "左移" Then
If Image1.Left >= 0 Then Image1.Left = Image1.Left - 20
If Image1.Left <= 0 Then S = "右移"
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = True
End Sub
展开全部
Dim
S
As
String
Private
Sub
Form_Load()
Timer1.Enabled
=
True
Timer1.Interval
=
100
Image1.Left
=
0
S
=
"右移"
End
Sub
Private
Sub
Timer1_Timer()
If
S
=
"右移"
Then
If
Image1.Left
+
Image1.Width
<=
Me.Width
Then
Image1.Left
=
Image1.Left
+
20
If
Image1.Left
+
Image1.Width
>=
Me.Width
Then
S
=
"左移"
ElseIf
S
=
"左移"
Then
If
Image1.Left
>=
0
Then
Image1.Left
=
Image1.Left
-
20
If
Image1.Left
<=
0
Then
S
=
"右移"
End
If
End
Sub
Private
Sub
Command1_Click()
Timer1.Enabled
=
False
End
Sub
Private
Sub
Command2_Click()
Timer1.Enabled
=
True
End
Sub
S
As
String
Private
Sub
Form_Load()
Timer1.Enabled
=
True
Timer1.Interval
=
100
Image1.Left
=
0
S
=
"右移"
End
Sub
Private
Sub
Timer1_Timer()
If
S
=
"右移"
Then
If
Image1.Left
+
Image1.Width
<=
Me.Width
Then
Image1.Left
=
Image1.Left
+
20
If
Image1.Left
+
Image1.Width
>=
Me.Width
Then
S
=
"左移"
ElseIf
S
=
"左移"
Then
If
Image1.Left
>=
0
Then
Image1.Left
=
Image1.Left
-
20
If
Image1.Left
<=
0
Then
S
=
"右移"
End
If
End
Sub
Private
Sub
Command1_Click()
Timer1.Enabled
=
False
End
Sub
Private
Sub
Command2_Click()
Timer1.Enabled
=
True
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询