[VBA ] 怎模改成大衛之星?
我們要畫一個圖
叫做大衛之星
就是除了2邊不連線,其他的點都要連載一起
而且還可以決定角數目
可以幫我看一下怎改嗎?
我這是多邊形的網狀
要改成大衛之星
就是一個點的兩邊不連線
其他都要連
=========================================================
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
g.Clear(Color.LightGray)
Dim pen As Pen = New Pen(Color.Red, 2)
Dim brush As SolidBrush = New SolidBrush(Color.Blue)
Dim font As Font = New Font("標楷體", 14)
Dim i, j, x, y, x1, y1, x2, y2 As Integer
Dim size As Integer = 60
g.DrawString("u9921313_14", font, brush, 5, 5)
x = Me.ClientSize.Width / 2
y = Me.ClientSize.Height / 2
x1 = x + size * Math.Sin(0)
y1 = y + size * Math.Cos(0)
For j = 0 To 60
x2 = x + size * Math.Sin(360 / 9 * j * Math.PI / 180)
y2 = y + size * Math.Cos(360 / 9 * j * Math.PI / 180)
g.DrawLine(pen, x1, y1, x2, y2)
x1 = x2
y1 = y2
For i = 0 To 60
x2 = x + size * Math.Sin(360 / 9 * i * Math.PI / 180)
y2 = y + size * Math.Cos(360 / 9 * i * Math.PI / 180)
g.DrawLine(pen, x1, y1, x2, y2)
Next i
Next j
End Sub
End Class
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.168.12.73
→
12/26 16:30, , 1F
12/26 16:30, 1F
→
12/28 00:37, , 2F
12/28 00:37, 2F
→
12/28 00:41, , 3F
12/28 00:41, 3F