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
 
 
 
 
 
TitleFind an ActiveX control's bounds in the parent that contains it
KeywordsActiveX control, bounds, Extender
CategoriesActiveX
 
Use the UserControl.Extender object's Left and Top properties, plus the UserControl's Width and Height properties.
 
' Draw a line around the control on its parent.
' Note that this assumes the parent has Line,
' ScaleX, and ScaleY methods, and a ScaleMode property.
Private Sub UserControl_Paint()
    On Error Resume Next
    Dim X As Single
    Dim Y As Single
    Dim wid As Single
    Dim hgt As Single
    X = UserControl.Extender.Left - Parent.ScaleX(120, _
        vbTwips, Parent.ScaleMode)
    Y = UserControl.Extender.Top - Parent.ScaleY(120, _
        vbTwips, Parent.ScaleMode)
    wid = Parent.ScaleX(Width + 240, vbTwips, _
        Parent.ScaleMode)
    hgt = Parent.ScaleY(Height + 240, vbTwips, _
        Parent.ScaleMode)
    Parent.Line (X, Y)-Step(wid, hgt), , B
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated