[求助]circle用法
Circle (x0, y0), r, , -a1, -a2 有问题Option Explicit
Dim a$(), b%(), n%, max%, w!, x1!, x2!, y1!, y2!, i%
Public Sub ini()
Cls
n = 0: max = 0
Open "data.txt" For Input As #1
Do While Not EOF(1)
n = n + 1
ReDim Preserve a(n)
ReDim Preserve b(n)
Input #1, a(n), b(n)
If b(n) > max Then max = b(n)
Loop
Close #1
Scale (-3, max * 1.2)-(max * 1.2, -max * 0.1)
Line (0, 0)-(max * 1.2, 0)
Line (0, max * 1.2)-(0, 0)
CurrentX = 0: CurrentY = -1
w = max / 2 / n
For i = 1 To UBound(a)
CurrentX = (2 * i - 1) * w
Print a(i);
Next
End Sub
Private Sub menu1_Click()
ini
w = max / 2 / n
x1 = w
For i = 1 To n
x2 = x1 + w
y2 = b(i)
Randomize
Line (x1, 0)-(x2, y2), QBColor(Rnd * 10), BF
CurrentX = x1
CurrentY = y2 + max * 0.1
Print b(i)
x1 = x2 + w
Next
End Sub
Private Sub menu2_Click()
Dim sum%, x0!, y0!, a1!, a2!, r!
Const pi = 3.14159265359
Cls
x0 = ScaleWidth / 2
y0 = ScaleHeight / 2
For i = 1 To n
sum = sum + b(i)
Next
a1 = 0.000000001
For i = 1 To n
a2 = a1 + 2 * pi * b(i) / sum
FillColor = QBColor(Rnd * 15)
r = 2 * ScaleHeight / 5
Circle (x0, y0), r, , -a1, -a2
CurrentX = x0 + r * Cos((a1 + a2) / 2)
CurrentY = y0 + r * Cos((a1 + a2) / 2)
Print Format(b(i) / sum * 100, "0.00"); "%"
a1 = a2
Next
End Sub