by Besmellah-from-Danmark (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 8th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Hide a part of the form with this easy code.
Dim Result As Long
Dim Points(1 To 4) As POINTAPI
Private Sub Command2_Click()
hRgn = CreatePolygonRgn(Points(1), 4, 1)
Result = SetWindowRgn(Form1.hWnd, hRgn, True)
End Sub
Private Sub Command1_Click()
Call Polyline(Form1.hdc, Points(1), 4)
End Sub
Private Sub Command3_Click()
Result = SetWindowRgn(Form1.hWnd, 0, True)
End Sub
Private Sub Form_Load()
Points(1).X = 500
Points(1).Y = 500
Points(2).X = 0
Points(2).Y = 0
Points(3).X = 1000
Points(3).Y = 0
Points(4).X = 500
Points(4).Y = 500
End Sub
'''' paste this code in a module''''''''''''
Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, _
ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As _
POINTAPI, ByVal nCount As Long) As Long
Public Type POINTAPI
X As Long
Y As Long
End Type