Results 1 to 4 of 4

Thread: Getting .Top & .Left properties of self

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416

    Getting .Top & .Left properties of self

    Ok, In my code of my activex control, I want to be able to get the .Left & .Top properties of itself on the form.

    Like say in the UserControl_Initialize() method.....
    Code:
    Private Sub UserControl_Initialize()
        Dim nTop as Integer, nLeft as Integer
    
        nTop = Me.Top
        nLeft = Me.Left
    End Sub
    .... except Top & Left properties dont exist.... So how do I get the top and left props? :/

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    Ok, solved....

    Code:
        Dim wndpl As WINDOWPLACEMENT
        GetWindowPlacement UserControl.hwnd, wndpl

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    The Left and Top (and many other) properties of a UserControl are available through the Extender property. The Extender object handles the properties of a control that are managed by it's container.

    The Extender properties are not available until the control has been sited (ie cannot be used in the Initialize event).

    Private Sub UserControl_Show()
    Dim nTop as Integer, nLeft as Integer

    nTop = UserControl.Extender.Top
    nLeft = UserControl.Extender.Left
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    ahh... Thanks a bunch!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width