Link to home
Start Free TrialLog in
Avatar of sgs1970
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  
 
Avatar of AlexFM
AlexFM

       Dim form As New Form1
        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.
ASKER CERTIFIED SOLUTION
Avatar of Mohamed Zedan
Mohamed Zedan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial