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
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")) "這裡是隨機生成的資料!
End Sub
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