vb中小球上下运动的程序代码
展开全部
CSDN
追问
嘛意思?
追答
www,csdn,net
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-07-18
展开全部
Option Explicit
Dim h0 As Single
Dim T As Single
Dim s As Single
Dim h As Single
Dim v As Single
Const g = 9.8
Private Sub Command1_Click()
Timer1 = True
End Sub
Private Sub Form_Load()
ScaleMode = 6 '毫米
Me.Scale (-1, 110)-(153, -10)
Timer1.Interval = 9
Timer1.Enabled = False
Timer2.Interval = 9
Timer2.Enabled = False
h0 = 100
v = 1
End Sub
Private Sub Timer1_Timer()
'Cls
T = T + 0.1
v = v + 0.05
If v > 152 Then
v = 2
Cls
End If
s = 0.5 * g * T ^ 2
h = h0 - s
Circle (v, h), 0.5, vbRed
Line (0, 100)-(153, 100), vbBlue
Line (0, 0)-(153, 0), vbBlue
If h <= 0 Then
h0 = h0 * 0.99
T = (2 * h0 / 9.8) ^ 0.5
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
'Cls
T = T - 0.1
v = v + 0.05
If v > 152 Then
v = 2
Cls
End If
s = h0 - 0.5 * g * T ^ 2
Circle (v, s), 0.5, vbRed
If T <= 0 Then
T = 0
s = 0
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
Dim h0 As Single
Dim T As Single
Dim s As Single
Dim h As Single
Dim v As Single
Const g = 9.8
Private Sub Command1_Click()
Timer1 = True
End Sub
Private Sub Form_Load()
ScaleMode = 6 '毫米
Me.Scale (-1, 110)-(153, -10)
Timer1.Interval = 9
Timer1.Enabled = False
Timer2.Interval = 9
Timer2.Enabled = False
h0 = 100
v = 1
End Sub
Private Sub Timer1_Timer()
'Cls
T = T + 0.1
v = v + 0.05
If v > 152 Then
v = 2
Cls
End If
s = 0.5 * g * T ^ 2
h = h0 - s
Circle (v, h), 0.5, vbRed
Line (0, 100)-(153, 100), vbBlue
Line (0, 0)-(153, 0), vbBlue
If h <= 0 Then
h0 = h0 * 0.99
T = (2 * h0 / 9.8) ^ 0.5
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
'Cls
T = T - 0.1
v = v + 0.05
If v > 152 Then
v = 2
Cls
End If
s = h0 - 0.5 * g * T ^ 2
Circle (v, s), 0.5, vbRed
If T <= 0 Then
T = 0
s = 0
Timer1.Enabled = True
Timer2.Enabled = False
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用Shape控件作一个正圆,用代码改变它的左右相对位置就可以了,不知道你还有有什么要求吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询