473,394 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Dual Monitors

Assuming a user has a dual (or more) monitor setup, how do I force a
windows form application to open up and display in the default monitor
of the system?

Thanks in advance

Dave.

Jun 21 '06 #1
2 3655
> Assuming a user has a dual (or more) monitor setup, how do I force a
windows form application to open up and display in the default monitor
of the system?


Here's how to centre the form on the primary monitor:

***
Rectangle wa = Screen.PrimaryScreen.WorkingArea;
this.Location = new Point(
((wa.Width - this.Width) / 2) + wa.X,
((wa.Height - this.Width) / 2) + wa.Y);
***

It centres the window on the working area of the screen (i.e. not including the area taken up by the start bar etc.) If
you would prefer to make it based on the full screen area then set wa to Screen.PrimaryScreen.Bounds instead.
Hope this helps,

Mike
- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Jun 21 '06 #2
Excellent -many thanks - works a treat.
Mike D Sutton wrote:
Assuming a user has a dual (or more) monitor setup, how do I force a
windows form application to open up and display in the default monitor
of the system?


Here's how to centre the form on the primary monitor:

***
Rectangle wa = Screen.PrimaryScreen.WorkingArea;
this.Location = new Point(
((wa.Width - this.Width) / 2) + wa.X,
((wa.Height - this.Width) / 2) + wa.Y);
***

It centres the window on the working area of the screen (i.e. not including the area taken up by the start bar etc.) If
you would prefer to make it based on the full screen area then set wa to Screen.PrimaryScreen.Bounds instead.
Hope this helps,

Mike
- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/


Jun 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: KJM | last post by:
How can I detect if the user has dual monitors and then how do I control which monitor a form is displayed on. Currently my forms always come up on my right monitor. What if I want to have it...
0
by: Mingle | last post by:
Hi, all I am developing a program for displaying two pictures separately in two monitors ( A and B). The goal is: when the mouse pointer is pointed to a picture loaded in picturebox1 in A, a...
3
by: Frank Rizzo | last post by:
Is there anyway to be able to split vs.net between 2 monitors? For instance, on one monitor, I'd like to have the form in design mode, while the other monitor would have the code for the form. ...
2
by: Strah | last post by:
Is there a way to determine whether a computer is connected to dual monitors with VB.NET code? Thanks, Strah
3
by: fournij | last post by:
Hi I'm writing a MFC C++ application using Visual .NET. I'm using a Dual Head video card with 2 monitors. I want to start my application in the first monitor but open a dialog box in the...
0
by: Neji | last post by:
Is there a way to make a keyboard shortcut to change the mouse focus between dual monitors? For example, if I'm on the left-hand screen, would be able to hit a button combination that would change...
0
by: Neji | last post by:
Is it possible to switch between dual monitors with the keyboard? For example, if I am on the left-hand monitor, can I press a keyboard combination to teleport the mouse cursor to the middle of...
8
by: Sheldon | last post by:
I just received a 2nd (configured as a dual) monitor but, for Access only, I can't seem to figure out, if it's possible, to view, say, Table1 on one monitor and Table2 on the other monitor. If I...
2
by: Cindy | last post by:
I've been using dual monitors for about a year now (absolutely love it), but have run into a weird situation with Access 2000 lately. I loaded a database on two PC's that do NOT have dual...
3
by: kssnatha | last post by:
Hi, I have a issue when i open a popup in dual monitors. I opened a popup from my page using windows.open() method. During popup loading i used both moveTo and resizeTo methods. Its working fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.