Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake an elliptical ActiveX picture control
Keywordselliptical control, ActiveX control, picture control
CategoriesControls, ActiveX Controls, ActiveX, Graphics
 
In the UserControl's Resize event handler, use the CreateEllipticRgn, SetWindowRgn, and DeleteObject API functions to restrict the control to an elliptical region.
 
' 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated