Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Position a form relative to an object on another form


Message #1 by "Noah Weiss" <crichton2b@m...> on Mon, 12 Feb 2001 18:36:52 -0500
I played with this for a few minutes.  I put a cmd button on form 1 and put
this code in its click event. It seems to do what you want it to do. You can
probably tweek it for you specific case. Hope it helps.
Rick.

    Load Form2
    Form2.Left = Form1.Left + Form1.Text1.Left
    Form2.Top = (Form1.Top + Form1.Text1.Top) - (Form2.Height -
Form1.Text1.Height)

    'in case the form goes off the top of the screen
    If Form2.Top < 0 Then
        Form2.Top = Form1.Top + Form1.Text1.Top + Form1.Text1.Height
    End If
    Form2.Show

--
Rick Delorme
Programmer/Analyst
Census Operations Division
Statistics Canada, Ottawa
http://www.rickdelorme.com
rick@r...
"Noah Weiss" <crichton2b@m...> wrote in message news:38518@p..._vb...
>
> Hi everyone,
>
> What I'm trying to do is load form2 (form1 is already loaded) and have it
> positioned right above text1 (so that both are visible, but they're both
> lined up correctly).
>
> This is the code Im using, yet for some reason it doesn't work at all:
>
> Form2.Move Text1.Left, Text1.Top - Text1.Height
> Form2.Show
>
> Any ideas?
>
> BTW the second form is being used as a context-sensitive  tooltip form.
>
> Thanks
> noah
> student
>
>
>



  Return to Index