高手能帮忙看下哪里出错来,谢谢!
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As LongPrivate Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim ap(4) As POINTAPI
Dim hx As Integer
Dim hy As Integer
Dim rergn As Integer
If Command1.Caption = "恢复" Then
Command1.Caption = "菱形"
SetWindowRgn Me.hWnd, 0, True
Else
Command1.Caption = "恢复"
hy = Me.Height \ (2 * Screen.TwipsPerPixelY)
hx = Me.Width \ (2 * Screen.TwipsPerPixelX)
ap(0).x = 0: ap(0).y = hy
ap(1).x = hx: ap(1).y = 0
ap(2).x = Me.Width \ Screen.TwipsPerPixelX: ap(2).y = hy
ap(3).x = hx: ap(3).y = Me.Height \ Screen.TwipsPerPixelY
ap(4) = ap(0)
rergn = CreatePolygonRgn(ap(0), 5, 1)
SetWindowRgn Me.hWnd, rergn, True
End If
End Sub