展开全部
用line控件,或line命令都可以画。
你要先计算出五角星的五个点的坐标,就可以了。
代码:
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Const Pi = 3.14159265358979
Cls
r = Val(InputBox("输入五角星的直径,大于1000")) / 2
'中心坐标是(x,y)
'求五个点的坐标
X1 = X: Y1 = Y - r
X2 = X + r * Cos(Pi / 10)
Y2 = Y - r * Sin(Pi / 10)
X3 = X + r * Cos(54 / 180 * Pi)
Y3 = Y + r * Sin(54 / 180 * Pi)
X4 = X - r * Cos(54 / 180 * Pi)
Y4 = Y3
X5 = X - r * Cos(18 / 180 * Pi)
Y5 = Y2
'画五角星
Line (X1, Y1)-(X3, Y3)
Line -(X5, Y5)
Line -(X2, Y2)
Line -(X4, Y4)
Line -(X1, Y1)
End Sub
你要先计算出五角星的五个点的坐标,就可以了。
代码:
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Const Pi = 3.14159265358979
Cls
r = Val(InputBox("输入五角星的直径,大于1000")) / 2
'中心坐标是(x,y)
'求五个点的坐标
X1 = X: Y1 = Y - r
X2 = X + r * Cos(Pi / 10)
Y2 = Y - r * Sin(Pi / 10)
X3 = X + r * Cos(54 / 180 * Pi)
Y3 = Y + r * Sin(54 / 180 * Pi)
X4 = X - r * Cos(54 / 180 * Pi)
Y4 = Y3
X5 = X - r * Cos(18 / 180 * Pi)
Y5 = Y2
'画五角星
Line (X1, Y1)-(X3, Y3)
Line -(X5, Y5)
Line -(X2, Y2)
Line -(X4, Y4)
Line -(X1, Y1)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询