VB的代码怎么改成VBA的代码

来源:百度知道 编辑:UC知道 时间:2024/05/23 19:43:12
做CAD的二次开发 现在有VB代码 要改成VBA的。。请高手指点
QQ: 14716085
Private Sub Command1_Click()
Picture1.Scale (-2400, -2400)-(3000, 3000)
Picture1.Cls
Dim n As Integer: Dim i As IFontDisp
Dim p As Double: Dim r As Double: Dim r1 As Double: Dim c As Double
p = 0.9: f = 0.2: c = 2#
n = InputBox("递归深度e.g.__5", "递归深度", n)
r1 = 0.5 * 479 / (1 - f) / (1 - p)
r = r1 / c
Picture1.Circle (639 / 2, 479 / 2), r
circles 639 / 2, 479 / 2, r, n + 1

End Sub
Private Sub circles(x, y, r, n)
Dim ccos(100) As Double: Dim csin(100) As Double: Dim i As Integer: Dim theta As Double: Dim nsatellite As Integer
f = 0.2: c = 2#: nsatellite 8
theta = 2 * 3.14159 / nsatellite
n1 = n - 1
fr = f * r
If n1 > 1 Then
For i = 0 To nsatellite
ccos(i) = c * Cos(i * theta)
csin (i) - c * Sin(i * theta)
Pictuer1.Circle (x + r * ccos(i), y + r

Sub tt()
Dim n As Integer
Dim p As Double, r As Double, r1 As Double, c As Double
p = 0.9: f = 0.2: c = 2#
n = InputBox("递归深度e.g.__5", "递归深度", n)
r1 = 0.5 * 479 / (1 - f) / (1 - p)
r = r1 / c
Dim pnt(2) As Double
pnt(0) = 639 / 2: pnt(1) = 479 / 2
ThisDrawing.ModelSpace.AddCircle pnt, r
circles 639 / 2, 479 / 2, r, n + 1

End Sub
Private Sub circles(x, y, r, n)
Dim ccos(100) As Double, csin(100) As Double, i As Integer, theta As Double, nsatellite As Integer
f = 0.2: c = 2#: nsatellite = 8
theta = 2 * 3.14159 / nsatellite
n1 = n - 1
fr = f * r
If n1 > 1 Then
For i = 0 To nsatellite
ccos(i) = c * Cos(i * theta)
csin(i) = c * Sin(i * theta)
Dim pnt(2) As Double
pnt(0) = x + r * ccos(i): pnt(1) = y + r * csin(i)
ThisDrawing.ModelSpace.AddCircle pnt, fr
circles x + r * ccos(i), y + r * csin(i), fr, n1
Next
End If
End Sub<