作者gogovovo0000 (狂扫千秋)
看板Visual_Basic
标题[VBA ] 怎模改成大卫之星?
时间Sat Dec 24 17:32:03 2011
我们要画一个图
叫做大卫之星
就是除了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
1F:→ Cypresslin:什麽叫做一个点的两边不连线....? 12/26 16:30
2F:→ MOONRAKER:大卫之星不是就两个三角形合起来变成一个六芒星…还有别 12/28 00:37
3F:→ MOONRAKER:种大卫之星喔? 12/28 00:41