Solved

How to control position of a modal window?

Posted on 2006-11-04
2
344 Views
Last Modified: 2010-04-23

 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  
 
0
Comment
Question by:sgs1970
2 Comments
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
       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.
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 125 total points
Comment Utility
but you have to set the form property

Form.StartPosition = FormStartPosition.Manual

for it to display at the position specified..
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now