【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“exp1.frm”一文,供大家参考学习
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "箭头形窗体"
ClientHeight = 3090
ClientLeft = 45
ClientTop = 435
ClientWidth = 7035
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "exp1.frx":0000
ScaleHeight = 3090
ScaleWidth = 7035
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 735
Left = 2640
Style = 1 'Graphical
TabIndex = 1
Top = 1800
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "箭头形窗体"
Height = 735
Left = 2640
Style = 1 'Graphical
TabIndex = 0
Top = 720
Width = 1455
End
End
Attribute
VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim coord() As POINTAPI
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Sub Command1_Click()
Dim hRgn As Long
Dim lRes As Long
ReDim coord(6) As POINTAPI '箭头形窗体共7个点,箭头顶点为2个位置重合点
With Me '7个点的具体坐标值
coord(0).X = ScaleWidth / 2
coord(0).Y = 0
coord(1).X = .ScaleWidth
coord(1).Y = .ScaleHeight / 2
coord(2).X = .ScaleWidth - (.ScaleWidth / 3)
coord(2).Y = .ScaleHeight / 2
coord(3).X = .ScaleWidth - (.ScaleWidth / 3)
coord(3).Y = .ScaleHeight
coord(4).X = .ScaleWidth / 3
coord(4).Y = .ScaleHeight
coord(5).X = .ScaleWidth / 3
coord(5).Y = .ScaleHeight / 2
coord(6).X = 0
coord(6).Y = .ScaleHeight / 2
End With
hRgn = CreatePolygonRgn(coord(0), 7, 2) '创建由这个7个点围成的区域
lRes = SetWindowRgn(Me.hWnd, hRgn, True) '创建箭头形窗体
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.ScaleMode = vbPixels '将窗体的单位设为象素
End Sub