1. 모듈에 다음의 API FUNCTION 을 선언합니다.
Public Declare Function CreateRectRgn Lib "gdi32" _
(ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Public Declare Function CreateEllipticRgn Lib "gdi32" _
(ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Public Declare Function CombineRgn Lib "gdi32" _
(ByVal hDestRgn As Long, _
ByVal hSrcRgn1 As Long, _
ByVal hSrcRgn2 As Long, _
ByVal nCombineMode As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" _
(ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Long) As Long
Public Const RGN_DIFF = 4
2. 폼의 Resize 이벤트에 다음과 같이 코딩을 해주십시요.
Private Sub Form_Resize()
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
ScaleMode = 3
If WindowState = vbMinimized Then Exit Sub
' 구멍날 영역을 생성한다.
wid = ScaleX(Width, vbTwips, vbPixels)
hgt = ScaleY(Height, vbTwips, vbPixels)
outer_rgn = CreateRectRgn(0, 0, wid, hgt)
border_width = (wid - ScaleWidth) / 2
title_height = hgt - border_width - ScaleHeight
inner_rgn = CreateEllipticRgn(border_width + ScaleWidth * 0.1, _
title_height + ScaleHeight * 0.1, _
ScaleWidth * 0.9, ScaleHeight * 0.9)
' Subtract the inner region from the outer.
combined_rgn = CreateRectRgn(0, 0, 0, 0)
CombineRgn combined_rgn, outer_rgn, inner_rgn, RGN_DIFF
' Restrict the window to the region.
SetWindowRgn hWnd, combined_rgn, True
End Sub
첫댓글 ㅎㅎ 별게 다 있습니다 그려..