📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "生成多边形"
ClientHeight = 1575
ClientLeft = 60
ClientTop = 345
ClientWidth = 3810
LinkTopic = "Form1"
ScaleHeight = 1575
ScaleWidth = 3810
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text1
Height = 285
Left = 1320
TabIndex = 1
Text = "3"
Top = 240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "生成"
Height = 375
Left = 1320
TabIndex = 0
Top = 840
Width = 1095
End
Begin VB.Label Label1
Caption = "输入边数:"
Height = 255
Left = 240
TabIndex = 2
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim num As Integer
Dim flag As Boolean
Private Sub Command1_Click()
num = CInt(Text1.Text)
Poly Form1
flag = True
End Sub
Private Sub Form_Load()
flag = False
End Sub
Private Sub Form_Click()
If flag Then
Unload Form1
End
End If
End Sub
Public Sub Poly(f As Form)
Dim hdc1 As Long
Dim rec(37) As POINTAPI
For i = 0 To num - 1 Step 1
rec(i).x = CInt(Int(Rnd() * 500) + 1)
rec(i).y = CInt(Int(Rnd() * 500) + 1)
Next
hdc1 = CreatePolygonRgn(rec(0), 37, ALTERNATE)
SetWindowRgn f.hWnd, hdc1, True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -