1个回答
展开全部
新建工程,1个timer1,1个shape,代码如下:
Dim i%
Private Sub Form_Load()
With Shape1
.Shape = 3
.BackColor = vbRed
.BackStyle = 1
.Height = 500
.Width = 500
End With
i = 0
Timer1.Enabled = True
Timer1.Interval = 30
End Sub
Private Sub Timer1_Timer()
If i = 0 Then
Shape1.Left = Shape1.Left + 20
If Shape1.Left = Me.ScaleWidth - Shape1.Width Then i = 1
ElseIf i = 1 Then
Shape1.Left = Shape1.Left - 20
If Shape1.Left = 0 Then i = 0
End If
End Sub
Dim i%
Private Sub Form_Load()
With Shape1
.Shape = 3
.BackColor = vbRed
.BackStyle = 1
.Height = 500
.Width = 500
End With
i = 0
Timer1.Enabled = True
Timer1.Interval = 30
End Sub
Private Sub Timer1_Timer()
If i = 0 Then
Shape1.Left = Shape1.Left + 20
If Shape1.Left = Me.ScaleWidth - Shape1.Width Then i = 1
ElseIf i = 1 Then
Shape1.Left = Shape1.Left - 20
If Shape1.Left = 0 Then i = 0
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
11
2024-11-15 广告
2024-11-15 广告
上海允若信息科技有限公司成立于2017年,是一家专注于电磁和等离子体仿真测试解决方案咨询、规划、定制开发和实施推广服务的专业化公司,允若意为:一允千金,上善若水。公司核心团队成员都毕业于国内外著名大学,在世界500强企业有多年工作经验。总部...
点击进入详情页
本回答由11提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询