vb课程设计,怎么做一个小球沿着正弦曲线运动的程序
答案:4 悬赏:30 手机版
解决时间 2021-11-28 07:21
- 提问者网友:你独家记忆
- 2021-11-27 21:37
vb课程设计,怎么做一个小球沿着正弦曲线运动的程序
最佳答案
- 五星知识达人网友:上分大魔王
- 2021-11-27 22:36
Const π As Single = 3.1415926
Dim x As Single
Private Sub Command1_Click()
Timer1.Interval = 1
End Sub
Private Sub Form_Load()
Picture1.Left = 50
Picture1.Top = 50
Picture1.Width = Me.Width - 220
Picture1.Height = Me.Height - 1000
Picture1.Scale (-2 * π, 1.2)-(2 * π, -1.2)
Picture1.AutoRedraw = True
Picture1.DrawWidth = 1
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
Picture1.BackColor = vbBlack
Picture1.FillColor = vbRed
Picture1.FillStyle = 0
x = -2 * π
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
For i = -2 * π To 2 * π Step 0.001
Picture1.PSet (i, Sin(i)), vbGreen
Next i
End Sub
Private Sub Timer1_Timer()
Picture1.Cls
For i = -2 * π To 2 * π Step 0.001
Picture1.PSet (i, Sin(i)), vbGreen
Next i
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
Picture1.Circle (x, Sin(x)), 0.2, vbRed
x = x + 0.03
If x >= 2 * π Then x = -2 * π
End Sub
Dim x As Single
Private Sub Command1_Click()
Timer1.Interval = 1
End Sub
Private Sub Form_Load()
Picture1.Left = 50
Picture1.Top = 50
Picture1.Width = Me.Width - 220
Picture1.Height = Me.Height - 1000
Picture1.Scale (-2 * π, 1.2)-(2 * π, -1.2)
Picture1.AutoRedraw = True
Picture1.DrawWidth = 1
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
Picture1.BackColor = vbBlack
Picture1.FillColor = vbRed
Picture1.FillStyle = 0
x = -2 * π
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
For i = -2 * π To 2 * π Step 0.001
Picture1.PSet (i, Sin(i)), vbGreen
Next i
End Sub
Private Sub Timer1_Timer()
Picture1.Cls
For i = -2 * π To 2 * π Step 0.001
Picture1.PSet (i, Sin(i)), vbGreen
Next i
Picture1.Line (-2 * π, 0)-(2 * π, 0), vbBlue
Picture1.Line (0, -1.2)-(0, 1.2), vbBlue
Picture1.Circle (x, Sin(x)), 0.2, vbRed
x = x + 0.03
If x >= 2 * π Then x = -2 * π
End Sub
全部回答
- 1楼网友:独行浪子会拥风
- 2021-11-27 23:09
这个做过的。可以发给你看看。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯