Solved

Dialog box does not position correctly using FormStartPosition

Posted on 2006-11-09
2
578 Views
Last Modified: 2012-06-21
I cannot get my dialog box to display anywhere other than the top left corner.  I've seen posts where people claim that they have gotten this to work.  Any ideas???

HERE'S THE CODE...
RequestValidateForm frmValidate = new  RequestValidateForm();
frmValidate.requestValidateCtl1.oValidateResult = oValidateResult;
                              
frmValidate.StartPosition = FormStartPosition.CenterParent;
                              
DialogResult oResult =  frmValidate.ShowDialog(this);

I'VE ALSO TRIED...
frmValidate.StartPosition = FormStartPosition.Manual;
frmValidate.Location = new Point(SystemInformation.WorkingArea.Width / 2 - frmValidate.Size.Width / 2, SystemInformation.WorkingArea.Height - frmValidate.Size.Height);

AND THIS...
frmValidate.StartPosition = FormStartPosition.Manual;
frmValidate.Top = 150;
frmValidate.Left = 150;
0
Comment
Question by:thespiceman
2 Comments
 
LVL 3

Accepted Solution

by:
troywillmot earned 500 total points
ID: 17911399
That code seems to work fine for me. Is it possible there is code in your RequestValidateForm form class that is repositioning the form or preventing the location from being set (a property/method override or some code setting top/left/location etc) ?

Which version of VS/C# are you using ?
0
 

Author Comment

by:thespiceman
ID: 17916522
I checked and there were no overrides.  What I DID find was that the form was set to Maximized, i.e. WindowState=Maximized.  It is working now :)  Thanks!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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