Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2008, 05:03 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default How to Center Windows forms?

Hi

When my application loads up I would like to have it load in the center. I am not sure if I need to specify an X and Y location. If so how does it account for different screen sizes?

Also what happens if you have another form(called form2) and the user moves form1 from the center to the top right(or anywhere else). Can you make it so the form2 opens up in the top right on top of form1?

Thanks

 
Old September 11th, 2008, 05:20 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

From within the Visual Studio environment, click on the form that you wish to have centered. In the Properties Window (press F4 if it's not visible), scroll down to the StartPosition property and select CenterScreen. You can do this for each form and all will be centered regardless of screen resolution.

Dr. Purdum





Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Forms sambathrajmca Windows Workflow 1 November 27th, 2007 06:25 AM
windows forms lakshmiR .NET Framework 1.x 1 August 31st, 2007 08:32 PM
Windows Media Center SDK emanueletorre C# 2005 0 November 29th, 2006 05:27 AM
Windows Media Center SDK emanueletorre C# 0 November 29th, 2006 05:26 AM
windows forms chandrasekhar ASP.NET 2.0 Professional 2 February 27th, 2006 10:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.