vb课程设计,怎么做一个小球沿着正弦曲线运动的程序?一个实心的小红球沿SIN(X)的曲线匀速运动.要求速度值和曲线区间可由用户在界面自行设置,运动过程可随时停止和启动.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 04:35:08

vb课程设计,怎么做一个小球沿着正弦曲线运动的程序?一个实心的小红球沿SIN(X)的曲线匀速运动.要求速度值和曲线区间可由用户在界面自行设置,运动过程可随时停止和启动.
vb课程设计,怎么做一个小球沿着正弦曲线运动的程序?
一个实心的小红球沿SIN(X)的曲线匀速运动.要求速度值和曲线区间可由用户在界面自行设置,运动过程可随时停止和启动.

vb课程设计,怎么做一个小球沿着正弦曲线运动的程序?一个实心的小红球沿SIN(X)的曲线匀速运动.要求速度值和曲线区间可由用户在界面自行设置,运动过程可随时停止和启动.
改个txt复制后改名为Form1.frm
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "Form1"
ClientHeight = 4545
ClientLeft = 120
ClientTop = 450
ClientWidth = 6465
LinkTopic = "Form1"
ScaleHeight = 303
ScaleMode = 3 'Pixel
ScaleWidth = 431
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox TxtFle
Height = 270
Index = 1
Left = 3960
TabIndex = 3
Text = "2"
Top = 2520
Width = 735
End
Begin VB.TextBox TxtFle
Height = 270
Index = 0
Left = 1800
TabIndex = 2
Text = "0"
Top = 2520
Width = 735
End
Begin VB.HScrollBar HScroll1
Height = 375
Left = 2520
Max = 300
TabIndex = 1
Top = 2880
Width = 1335
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 30
Left = 1080
Tag = "0"
Top = 3360
End
Begin VB.CommandButton Command1
Caption = "开始"
Height = 375
Left = 600
TabIndex = 0
Top = 2880
Width = 855
End
Begin VB.Label Label3
Caption = "速度"
Height = 375
Left = 1800
TabIndex = 6
Top = 3000
Width = 615
End
Begin VB.Label Label2
Caption = "最大PI单位"
Height = 255
Left = 2640
TabIndex = 5
Top = 2520
Width = 1095
End
Begin VB.Label Label1
Caption = "最小PI单位"
Height = 255
Left = 600
TabIndex = 4
Top = 2520
Width = 1095
End
Begin VB.Shape Shape1
BackStyle = 1 'Opaque
Height = 255
Left = 2040
Shape = 3 'Circle
Top = 1560
Width = 135
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SpaceTop As Integer
Dim StepB As Double
Const PI = 3.1415926
Dim SFlag As Boolean
Dim MaxSpeed As Integer
Dim MaxFle As Double
Dim MinFle As Double
Dim Bl As Integer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Timer1.Enabled = True
Command1.Caption = "停止"
Else
Timer1.Enabled = False
Command1.Caption = "开始"
End If
End Sub
Private Sub Form_Load()
Bl = 40
SpaceTop = 40
MaxFle = 2 * PI
MinFle = 0
StepB = PI / 100
MaxSpeed = 51
HScroll1.Max = MaxSpeed - 1
HScroll1.Min = 0
HScroll1.Value = 40
Timer1.Interval = MaxSpeed - HScroll1.Value
End Sub
Private Sub HScroll1_Change()
On Error Resume Next
Timer1.Interval = MaxSpeed - HScroll1.Value
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Me.CurrentX = Timer1.Tag * Bl
Me.CurrentY = SpaceTop + Sin(Timer1.Tag) * Bl
Me.Print "."
If Timer1.Tag = MinFle Then
Shape1.Left = Timer1.Tag * Bl - Shape1.Width / 2
Shape1.Top = SpaceTop + Sin(Timer1.Tag) * Bl - Shape1.Width / 2
If SFlag = False Then
Timer1.Tag = Timer1.Tag + StepB
Else
Timer1.Tag = Timer1.Tag - StepB
End If
Else
If SFlag = False Then
SFlag = True
Timer1.Tag = MaxFle
Else
SFlag = False
Timer1.Tag = MinFle
End If
End If
Timer1.Enabled = True
End Sub
Private Sub TxtFle_Change(Index As Integer)
MaxFle = Val(TxtFle(1)) * PI
MinFle = TxtFle(0) * PI
End Sub
其他的自己完善一下吧 下班喽

vb课程设计,怎么做一个小球沿着正弦曲线运动的程序?一个实心的小红球沿SIN(X)的曲线匀速运动.要求速度值和曲线区间可由用户在界面自行设置,运动过程可随时停止和启动. 环境生态学课程设计怎么做? 用几何画板做正弦曲线的平移法怎么做 直流稳压电源的课程设计怎么做啊? VB随机数怎么做 VB作业怎么做 Mathematica 动画:用Mathematica画一个小球在一正弦曲线上运动 怎样在UG中做一个沿正弦曲线的圆柱要求 每个与正弦曲线垂直的截面都是圆 怎么做化工课程设计/?谢谢了,大神帮忙啊 水温测量仪课程设计我是第一次做课程设计,要做一个水温测量仪,请问做这个的大概步骤是什么? 如何做课程设计 vb用双圆弧拟合画正弦曲线的程序 C语言数组的定义问题我做的是正弦曲线的取点集合,也就是把正弦曲线一个周期取点保存在一个数组里面,比如我打算取320个点,由于数组元素比较多,那么这个str{}应该怎么定义呢?什么类型的? 裴波那契数用VB怎么做 怎么做VB语言的计算器啊 C语言中如何描绘正弦曲线?是这样的,我在做单片机的一个程序,需要把正弦曲线显示在LCD上,道理其实很简单,就是一个一个的描点然后再把这些点连接起来就行了,但是这些点怎么取?我首先取 把一个小球放在玻璃漏斗中,摇晃漏斗,可以使小球沿着光滑的漏斗壁在某一水平面内做匀速圆周运动哦,小球的向心力是由什么力提供的 在光滑玻璃漏斗中有一个小球沿着漏斗的内壁在一水平面内做匀速圆周运动.在光滑玻璃漏斗中有一个小球沿着漏斗的内壁在一水平面内做匀速圆周运动,这时小球收到的力是重力和支持力,为