怎样在vb里使像片(picture)按照指定的轨迹运动,比如按照圆形轨迹运动,求指点???
1个回答
展开全部
一个picture1,一个timer1.
代码如下:圆形轨迹
Dim angle As Double
Const PI = 3.1415926
Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
angle = angle + PI / 90
Picture1.Left = 500 * Cos(angle) + Me.ScaleWidth / 2
Picture1.Top = 500 * Sin(angle) + Me.ScaleHeight / 2
End Sub
代码如下:圆形轨迹
Dim angle As Double
Const PI = 3.1415926
Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
angle = angle + PI / 90
Picture1.Left = 500 * Cos(angle) + Me.ScaleWidth / 2
Picture1.Top = 500 * Sin(angle) + Me.ScaleHeight / 2
End Sub
追问
谢谢。还有我想问一下能不能用picture.move的方法来移动???
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询