Anybody mind helping me perfect this function?
I wrote this btw...
API:
Code:
Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32.dll" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Const RGN_DIFF As Long = 4
Code:
Private Function CreateRoundRectRgnI(ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Dim rgnTopLeft As Long, rgnTopRight As Long, rgnBtmLeft As Long, rgnBtmRight As Long
Dim rgnMain As Long
Dim rgnHolder As Long
rgnTopLeft = CreateEllipticRgn(-(X3), -(Y3), X3, Y3)
rgnTopRight = CreateEllipticRgn((X2 + X3), -(Y3), X2 - X3, Y3)
rgnBtmLeft = CreateEllipticRgn(-(X3), (Y2 + Y3), X3, Y2 - Y3)
rgnBtmRight = CreateEllipticRgn((X2 + X3), (Y2 + Y3), X2 - X3, Y2 - Y3)
rgnMain = CreateRectRgn(0, 0, X2, Y2)
rgnHolder = CreateRectRgn(0, 0, 0, 0)
CombineRgn rgnHolder, rgnMain, rgnTopLeft, RGN_DIFF
CombineRgn rgnMain, rgnHolder, rgnTopRight, RGN_DIFF
CombineRgn rgnHolder, rgnMain, rgnBtmLeft, RGN_DIFF
CombineRgn rgnMain, rgnHolder, rgnBtmRight, RGN_DIFF
CreateRoundRectRgnI = rgnMain
End Function