Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleCreate an ActiveX control with a borderless menu bar
KeywordsActiveX control, menu
CategoriesActiveX, Controls
 
Place a form in the ActiveX control project. Use the SetParent API function to display the form inside the control.

When the control resizes, make it resize the form. Make the form use SetWindowRgn to restrict itself to occupy only the area covered by its menus. This removes the borders.

 
' Restrict the form so it just shows its menus.
Private Sub Form_Resize()
Dim rgn As Long
Dim wid As Single
Dim hgt As Single
Dim border_width As Single

    ' Create the region.
    wid = ScaleX(Width, vbTwips, vbPixels)
    hgt = ScaleY(Height, vbTwips, vbPixels)
    ScaleMode = vbPixels
    border_width = (wid - ScaleWidth) / 2
    rgn = CreateRectRgn( _
        border_width, border_width, _
        wid - border_width, _
        hgt - border_width - ScaleHeight - 1)

    ' Restrict the window to the region.
    SetWindowRgn hWnd, rgn, True
    DeleteObject rgn
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated