回复 2楼 missphoenix
好的
这是第一个
Dim t1, t2, t3, t4 As Double '定义两杆间的夹角
Dim l1, l2, l3, l4 As Long '定义各杆的长度
Dim xa As Double, ya As Double '
Dim xb As Double, yb As Double '
Dim xc As Double, yc As Double '
Dim xd As Double, yd As Double '定义各个绞支点的坐标
Const pi = 3.1415926 '定义一个常量来计算弧度
Public Sub Form_Load() '初始化杆一的位置
t1 = -90 * pi / 180
t2 = -90 * pi / 180
l1 = 95
l3 = 95
l4 = 50
End Sub
Private Sub Command1_Click()
Picture1.Scale (-200, 200)-(200, -200)
Timer1.Interval = 1
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else:
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
xaa = xa
yaa = ya
xbb = xb
ybb = yb
xcc = xc
ycc = yc
xdd = xd
ydd = yd
xa = 0
ya = 0
xb = l1 * Cos(t1)
yb = -l1 * Sin(t1)
xd = l4
yd = 0
xc = xd + l3 * Cos(t2)
yc = yd - l3 * Sin(t2)
t1 = t1 + pi / 180
t2 = t2 + pi / 180
Picture1.Cls
Picture1.DrawWidth = 10
'Picture1.Circle (xa, ya), 1, QBColor(4)
'Picture1.Circle (xb, yb), 1, QBColor(8)
'Picture1.Circle (xc, yc), 1, QBColor(13)
'Picture1.Circle (xd, yd), 1, QBColor(4)
Picture1.DrawWidth = 4
Picture1.Line (xa, ya)-(xb, yb), QBColor(1)
Picture1.Line (xb, yb)-(xc, yc), QBColor(4)
Picture1.Line (xc, yc)-(xd, yd), QBColor(8)
Picture1.Line (xd, yd)-(xa, ya), QBColor(13)
'在picture1中擦去上一点的连杆机构位置,并画出新的连杆机构的位置,视觉上感觉为动画
End Sub
这是第二个
Const pi = 3.14159
Dim a
Private Sub Command1_Click()
Picture1.Cls
Picture1.ScaleMode = 0
Picture1.ScaleMode = 3
Picture1.Scale (-10, 10)-(10, -10)
Picture1.DrawWidth = 1
Picture1.Line (-10, 0)-(10, 0), vbBlue
Picture1.Line (9, 0.5)-(10, 0), vbBlue
Picture1.Line -(9, -0.5), vbBlue
Picture1.ForeColor = vbBlue
Picture1.Print "X"
Picture1.Line (0, 10)-(0, -10), vbBlue
Picture1.Line (0.5, 9)-(0, 10), vbBlue
Picture1.Line -(-0.5, 9), vbBlue
Picture1.Print "Y"
Picture1.CurrentX = 0.5
Picture1.CurrentY = -0.5
Picture1.Print "O"
Picture1.CurrentX = 8.5
Picture1.CurrentY = 2
Picture1.Print "Φ(°)"
Picture1.CurrentX = 0.8
Picture1.CurrentY = 9.5
Picture1.Print "rad/s"
Picture1.Line (2, 0)-(2, 0.5), vbBlue
Picture1.CurrentX = 2
Picture1.CurrentY = -0.5
Picture1.Print "90"
Picture1.Line (4, 0)-(4, 0.5), vbBlue
Picture1.CurrentX = 4
Picture1.CurrentY = -0.5
Picture1.Print "180"
Picture1.Line (6, 0)-(6, 0.5), vbBlue
Picture1.CurrentX = 6
Picture1.CurrentY = -0.5
Picture1.Print "270"
Picture1.Line (8, 0)-(8, 0.5), vbBlue
Picture1.CurrentX = 8
Picture1.CurrentY = -0.5
Picture1.Print "360"
Picture1.Line (-2, 0)-(-2, 0.5), vbBlue
Picture1.CurrentX = -2
Picture1.CurrentY = -0.5
Picture1.Print "-90"
Picture1.Line (-4, 0)-(-4, 0.5), vbBlue
Picture1.CurrentX = -4
Picture1.CurrentY = -0.5
Picture1.Print "-180"
Picture1.Line (-6, 0)-(-6, 0.5), vbBlue
Picture1.CurrentX = -6
Picture1.CurrentY = -0.5
Picture1.Print "-270"
Picture1.Line (-8, 0)-(-8, 0.5), vbBlue
Picture1.CurrentX = -8
Picture1.CurrentY = -0.5
Picture1.Print "-360"
Picture1.Line (0, pi)-(0.5, pi), vbBlue
Picture1.CurrentX = -0.8
Picture1.CurrentY = 3.4
Picture1.Print "10"
Picture1.Line (0, -pi)-(0.5, -pi), vbBlue
Picture1.CurrentX = -1#
Picture1.CurrentY = -3#
Picture1.Print "-10"
Picture1.DrawWidth = 2
For a = 0 To 2 * pi Step pi / 6000
Picture1.PSet (a, pi / 2), vbYellow
Next
Picture1.CurrentX = 4
Picture1.CurrentY = 2.8
Picture1.ForeColor = vbBlack
Picture1.Print "杆3角速度图"
End Sub