sgs1970
asked on
How to control position of a modal window?
I am developing a vb.net windows application. While showing a form as a modal dialog, how I can control the position where the modal window will appear . It is indeed good, if I can control the left and top of the window . Or the effect of "bottom of the parent" will be good enough.
thanking you,
Samson
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
form.Location = Me.Poi New Point(100, 100)
form.Width = 200
form.Height = 200
form.ShowDialog()
If you want to do this inside of child form itself, do this in the form Load event handler. To find new form coordinates relatively to parent coordinates, use Control.PointToCScreen Method. For example, this line
form.Location = Me.PointToScreen(New Point(100, 100))
sets child form torm to position (100, 100) relatively to current form.