' Give the control an elliptical region.
Private Sub UserControl_Resize()
Dim rgn As Long
Dim wid As Single
Dim hgt As Single
' Create the elliptical region.
wid = ScaleX(Width, vbTwips, vbPixels)
hgt = ScaleY(Height, vbTwips, vbPixels)
rgn = CreateEllipticRgn(0, 0, wid, hgt)
' Restrict the window to the region.
SetWindowRgn hWnd, rgn, True
DeleteObject rgn
End Sub
|