form1.frm
来自「很好的教程原代码!」· FRM 代码 · 共 79 行
FRM
79 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3105
ClientLeft = 60
ClientTop = 345
ClientWidth = 4380
LinkTopic = "Form1"
ScaleHeight = 3105
ScaleWidth = 4380
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1680
TabIndex = 0
Top = 1440
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim XY() As POINTAPI
' CreatePolygonRgn 函数声明
Private Declare Function CreatePolygonRgn Lib "gdi32" _
(lpPoint As POINTAPI, _
ByVal nCount As Long, _
ByVal nPolyFillMode As Long _
) As Long
' SetWindowRgn 函数声明
Private Declare Function SetWindowRgn Lib "user32" _
(ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean _
) As Long
' Form_Load 事件代码
Private Sub Form_Load()
Me.ScaleMode = vbPixels
End Sub
'Command1单击事件的代码
Private Sub Command1_Click()
Dim hRgn As Long
Dim lRes As Long
ReDim XY(7) As POINTAPI
'T 形需要 8 个点
With Me
XY(0).X = 0
XY(0).Y = 0
XY(1).X = .ScaleWidth
XY(1).Y = 0
XY(2).X = .ScaleWidth
XY(2).Y = .ScaleHeight / 2
XY(3).X = .ScaleWidth - (.ScaleWidth / 3)
XY(3).Y = .ScaleHeight / 2
XY(4).X = .ScaleWidth - (.ScaleWidth / 3)
XY(4).Y = .ScaleHeight
XY(5).X = .ScaleWidth / 3
XY(5).Y = .ScaleHeight
XY(6).X = .ScaleWidth / 3
XY(6).Y = .ScaleHeight / 2
XY(7).X = 0
XY(7).Y = .ScaleHeight / 2
End With
'
hRgn = CreatePolygonRgn(XY(0), 8, 2)
' 返回多边形区域的句柄
lRes = SetWindowRgn(Me.hWnd, hRgn, True)
' 设置多边形窗体
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?