|
楼主 |
发表于 2023-9-21 09:48
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我又改了下。
- Sub drawstar5()
- Dim ARR(1 To 4, 1 To 2) As Single
- pi = 3.1415926
- ActiveDocument.Shapes.SelectAll
- Selection.Delete
- A = 300: B = 200
- ARR(1, 1) = A: ARR(1, 2) = B
- ARR(4, 1) = ARR(1, 1): ARR(4, 2) = ARR(1, 2)
-
- l = 150
- For i = 0 To 9
- ARR(2, 1) = A + l * Cos((36 * i + 18) * pi / 180)
- ARR(2, 2) = B - l * Sin((36 * i + 18) * pi / 180)
- ARR(3, 1) = A + l * 0.5 * Cos((36 * i + 36 + 18) * pi / 180)
- ARR(3, 2) = B - l * 0.5 * Sin((36 * i + 36 + 18) * pi / 180)
- If i Mod 2 = 1 Then
- ARR(2, 1) = x: ARR(2, 2) = Y
- ARR(3, 1) = A + l * Cos((36 * i + 36 + 18) * pi / 180)
- ARR(3, 2) = B - l * Sin((36 * i + 36 + 18) * pi / 180)
- End If
- Set shp = ActiveDocument.Shapes.AddPolyline(ARR)
- shp.Fill.ForeColor.RGB = RGB(255, 0, 0)
- x = ARR(3, 1): Y = ARR(3, 2)
- Next
- End Sub
复制代码
这样能添加颜色,虽然不是渐进色。 |
|