展开全部
VB的例子:
调用的是API函数
Attribute VB_Name = "Module1"
Public Declare Function CreatePolygonRgn _
Lib "gdi32" _
( _
lpPoint As POINTAPI, ByVal nCount As Long, _
ByVal nPolyFillMode As Long _
) As Long
Public Type POINTAPI
x As Long
y As Long
End Type
'------------------------------------------------
'以上为声明CreatePolygonRgn函数和它需要的POINTAPI类型
Public Declare Function SetWindowRgn _
Lib "user32" _
( _
ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean _
) As Long
Public Const ALTERNATE = 1
'------------------------------------------
''以上为声明SetWindowRgn函数和它需要的常量
Public Sub Poly(f As Form)
Dim hdc1 As Long
Dim rec(37) As POINTAPI
rec(0).x = 102
rec(0).y = 11
rec(1).x = 12
rec(1).y = 102
rec(2).x = 11
rec(2).y = 107
rec(3).x = 10
rec(3).y = 119
rec(4).x = 11
rec(4).y = 124
rec(5).x = 13
rec(5).y = 127
rec(6).x = 72
rec(6).y = 187
rec(7).x = 51
rec(7).y = 211
rec(8).x = 50
rec(8).y = 227
rec(9).x = 52
rec(9).y = 230
rec(10).x = 52
rec(10).y = 233
rec(11).x = 54
rec(11).y = 235
rec(12).x = 55
rec(12).y = 237
rec(13).x = 60
rec(13).y = 241
rec(14).x = 64
rec(14).y = 234
rec(15).x = 66
rec(15).y = 246
rec(16).x = 72
rec(16).y = 248
rec(17).x = 82
rec(17).y = 248
rec(18).x = 86
rec(18).y = 247
rec(19).x = 87
rec(19).y = 247
rec(20).x = 88
rec(20).y = 246
rec(21).x = 185
rec(21).y = 150
rec(22).x = 187
rec(22).y = 145
rec(23).x = 189
rec(23).y = 138
rec(24).x = 187
rec(24).y = 129
rec(25).x = 186
rec(25).y = 125
rec(26).x = 183
rec(26).y = 121
rec(27).x = 127
rec(27).y = 64
rec(28).x = 142
rec(28).y = 43
rec(29).x = 143
rec(29).y = 30
rec(30).x = 140
rec(30).y = 24
rec(31).x = 139
rec(31).y = 21
rec(32).x = 126
rec(32).y = 10
rec(33).x = 120
rec(33).y = 9
rec(34).x = 110
rec(34).y = 9
rec(35).x = 104
rec(35).y = 12
hdc1 = CreatePolygonRgn(rec(0), 37, ALTERNATE)
SetWindowRgn f.hWnd, hdc1, True
End Sub
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3885
ClientLeft = 0
ClientTop = 0
ClientWidth = 2925
LinkTopic = "Form1"
Picture = "Form1.frx":0000
ScaleHeight = 3885
ScaleWidth = 2925
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Image Image1
Height = 480
Left = 1440
Picture = "Form1.frx":23BC2
Top = 360
Width = 480
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Poly Form1
End Sub
Private Sub Image1_Click()
Unload Form1
End
End Sub
Type=Exe
Module=Module1; Module1.bas
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\PWINNT\system32\Stdole2.tlb#OLE Automation
Form=Form1.frm
Startup="Form1"
HelpFile=""
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="feitian"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
调用的是API函数
Attribute VB_Name = "Module1"
Public Declare Function CreatePolygonRgn _
Lib "gdi32" _
( _
lpPoint As POINTAPI, ByVal nCount As Long, _
ByVal nPolyFillMode As Long _
) As Long
Public Type POINTAPI
x As Long
y As Long
End Type
'------------------------------------------------
'以上为声明CreatePolygonRgn函数和它需要的POINTAPI类型
Public Declare Function SetWindowRgn _
Lib "user32" _
( _
ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean _
) As Long
Public Const ALTERNATE = 1
'------------------------------------------
''以上为声明SetWindowRgn函数和它需要的常量
Public Sub Poly(f As Form)
Dim hdc1 As Long
Dim rec(37) As POINTAPI
rec(0).x = 102
rec(0).y = 11
rec(1).x = 12
rec(1).y = 102
rec(2).x = 11
rec(2).y = 107
rec(3).x = 10
rec(3).y = 119
rec(4).x = 11
rec(4).y = 124
rec(5).x = 13
rec(5).y = 127
rec(6).x = 72
rec(6).y = 187
rec(7).x = 51
rec(7).y = 211
rec(8).x = 50
rec(8).y = 227
rec(9).x = 52
rec(9).y = 230
rec(10).x = 52
rec(10).y = 233
rec(11).x = 54
rec(11).y = 235
rec(12).x = 55
rec(12).y = 237
rec(13).x = 60
rec(13).y = 241
rec(14).x = 64
rec(14).y = 234
rec(15).x = 66
rec(15).y = 246
rec(16).x = 72
rec(16).y = 248
rec(17).x = 82
rec(17).y = 248
rec(18).x = 86
rec(18).y = 247
rec(19).x = 87
rec(19).y = 247
rec(20).x = 88
rec(20).y = 246
rec(21).x = 185
rec(21).y = 150
rec(22).x = 187
rec(22).y = 145
rec(23).x = 189
rec(23).y = 138
rec(24).x = 187
rec(24).y = 129
rec(25).x = 186
rec(25).y = 125
rec(26).x = 183
rec(26).y = 121
rec(27).x = 127
rec(27).y = 64
rec(28).x = 142
rec(28).y = 43
rec(29).x = 143
rec(29).y = 30
rec(30).x = 140
rec(30).y = 24
rec(31).x = 139
rec(31).y = 21
rec(32).x = 126
rec(32).y = 10
rec(33).x = 120
rec(33).y = 9
rec(34).x = 110
rec(34).y = 9
rec(35).x = 104
rec(35).y = 12
hdc1 = CreatePolygonRgn(rec(0), 37, ALTERNATE)
SetWindowRgn f.hWnd, hdc1, True
End Sub
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3885
ClientLeft = 0
ClientTop = 0
ClientWidth = 2925
LinkTopic = "Form1"
Picture = "Form1.frx":0000
ScaleHeight = 3885
ScaleWidth = 2925
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Image Image1
Height = 480
Left = 1440
Picture = "Form1.frx":23BC2
Top = 360
Width = 480
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Poly Form1
End Sub
Private Sub Image1_Click()
Unload Form1
End
End Sub
Type=Exe
Module=Module1; Module1.bas
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\PWINNT\system32\Stdole2.tlb#OLE Automation
Form=Form1.frm
Startup="Form1"
HelpFile=""
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="feitian"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询