| Public Sub HoleInForm(Rectangular As Boolean, HoleWidth As Single, HoleHeight As Single, HoleLeft As Single, HoleTop As Single, Frm As Form) 'This will put a hole in the form (you can see through the form with that hole) On Error GoTo error Const RGN_DIFF = 4 Dim outer_rgn As Long Dim inner_rgn As Long Dim combined_rgn As Long Dim wid As Single Dim hgt As Single Dim border_width As Single Dim title_height As Single If Frm.WindowState = vbMinimized Then Exit Sub wid = ScaleX(Frm.width, vbTwips, vbPixels) hgt = ScaleY(Frm.height, vbTwips, vbPixels) outer_rgn = CreateRectRgn(0, 0, wid, hgt) border_width = (wid - ScaleWidth) / 2 title_height = hgt - border_width - ScaleHeight If Rectangular = True Then inner_rgn = CreateRectRgn(HoleLeft, HoleTop, HoleWidth, HoleHeight) Else inner_rgn = CreateEllipticRgn(HoleLeft, HoleTop, HoleWidth, HoleHeight) End If combined_rgn = CreateRectRgn(0, 0, 0, 0) CombineRgn combined_rgn, outer_rgn, inner_rgn, RGN_DIFF SetWindowRgn Frm.hWnd, combined_rgn, True Exit Sub error: MsgBox Err.Description, vbExclamation, "Error" End Sub |
Hole in the form |
Express News India | Freelance ecommerce web development India