VB 如何 绘制曲线图 曲线要求圆弧的·
2015-06-20 · 知道合伙人互联网行家
关注
展开全部
Option Explicit
Private Sub Form_click()
Cls
Dim i, j As Single
Me.Scale (-1, 10)-(25, -1) '定义坐标系,原点靠近左下角
Line (-1, 0)-(25, 0) '画x轴
Line (0, -1)-(0, 10) '画Y轴
For i = -1 To 25 Step 1 '画X轴刻度
If i <> 0 Then
Line (i, 0)-(i, 0.2)
CurrentX = i - 0.3: CurrentY = -0.2
Print i
End If
Next
For j = -1 To 10 '画Y轴刻度
If j <> 0 Then
Line (0, j)-(0.3, j)
CurrentX = -0.7: CurrentY = j + 0.1
Print j
End If
Next
CurrentX = -0.4: CurrentY = -0.2
Print "0" '画原点
CurrentX = 0.5: CurrentY = 9.5
Print "Y"
CurrentX = 24: CurrentY = 0.5
Print "X"
Randomize
CurrentX = 1: CurrentY = Format(Rnd * 10, "0.00")
For i = 2 To 24
Line -(i, Format(Rnd * 10, "0.00")) '这里是随机生成的数据!
Next
End Sub
Private Sub Form_click()
Cls
Dim i, j As Single
Me.Scale (-1, 10)-(25, -1) '定义坐标系,原点靠近左下角
Line (-1, 0)-(25, 0) '画x轴
Line (0, -1)-(0, 10) '画Y轴
For i = -1 To 25 Step 1 '画X轴刻度
If i <> 0 Then
Line (i, 0)-(i, 0.2)
CurrentX = i - 0.3: CurrentY = -0.2
Print i
End If
Next
For j = -1 To 10 '画Y轴刻度
If j <> 0 Then
Line (0, j)-(0.3, j)
CurrentX = -0.7: CurrentY = j + 0.1
Print j
End If
Next
CurrentX = -0.4: CurrentY = -0.2
Print "0" '画原点
CurrentX = 0.5: CurrentY = 9.5
Print "Y"
CurrentX = 24: CurrentY = 0.5
Print "X"
Randomize
CurrentX = 1: CurrentY = Format(Rnd * 10, "0.00")
For i = 2 To 24
Line -(i, Format(Rnd * 10, "0.00")) '这里是随机生成的数据!
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询