Positioning a child form over a control on main form

  • Thread starter Thread starter kevininstructor
  • Start date Start date
K

kevininstructor

I have a SDI Windows form application were the secondary form when shown
should appear directly below a text-box in the calling form. I thought the
code below might work (use to using ClientToScreen in Delphi) but alas it
doesn't. Any thoughts on how to do this?

Thanks
Kevin

....
Try
frmForm.Top = Me.TextBox1.Top + 100
frmForm.Left = Me.TextBox1.Left + Me.TextBox1.Height + 100
frmForm.ShowDialog(Me)
Finally
frmForm.Dispose()
End Try
 
Seems a solution appears "after" posting a question: Here is my solution
were line two uses PointToScreen
Dim f As New frmPropertyController
Dim Thelocation As Point = Me.PointToScreen(New Point(TextBox1.Left +
TextBox1.Width \ 2, TextBox1.Top + TextBox1.Height + 10))
Try
f.Location = Thelocation
f.ShowDialog(Me)
Finally
f.Dispose()
End Try
 
Back
Top