vb绘制钻石微观原子函数图代码
Private Sub Form_Click()Const PI = 3.14159265
Dim i As Integer, j As Integer
Dim sngX1 As Single, sngY1 As Single
Dim sngX2 As Single, sngY2 As Single
Dim sngAngle As Single
Dim sngRadius As Single
Dim intNodes As Integer
Form1.Scale (-1.5, -1.5)-(1.5, 1.5)
Cls
sngRadius = 1
intNodes = 15
sngAngle = 2 * PI / intNodes
For i = 1 To intNodes
sngX1 = sngRadius * Cos(i * sngAngle)
sngY1 = sngRadius * Sin(i * sngAngle)
For j = 1 To intNodes
If i <> j Then
sngX2 = sngRadius * Cos(j * sngAngle)
sngY2 = sngRadius * Sin(j * sngAngle)
Form1.Line (sngX1, sngY1)-(sngX2, Y2), vbRed
End If
Next
Next
End Sub
新手多多照顾