473,785 Members | 2,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3675
> 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.PrimaryS creen.WorkingAr ea;
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.PrimaryS creen.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.PrimaryS creen.WorkingAr ea;
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.PrimaryS creen.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
30453
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 always display on my left one? Thanks Ken
0
1069
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 "virtual" mouse pointer is drawn at the same location in picturebox2 in B. The program works well for two monitors with the same size (note: NOT the same resolution), even when I set two different resolutions for them, the mouse pointer locations in the...
3
3629
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. Or at least be able to split a code window between 2 monitors. Is this even possible? Thanks.
2
1795
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
7690
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 second monitor. I tried to set the X position of the dialog box greather thant the first screen resolution, but the dialog box still appear on the first monitor. Can you help me ?
0
1346
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 the mouse focus to the right-hand monitor? It seems like I waste a large amount of time moving the mouse between monitors, so it would be great if I could switch the mouse focus with the keyboard. VB appears to have MouseFocus functionality,...
0
1276
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 the right-hand monitor? And if I am on the right-hand monitor, can I press a keyboard combination to teleport the mouse cursor to the middle of the left-hand monitor? Is this something that can be done in .NET and/or VB?
8
6111
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 open Table1, then Table2, Table2 apparently sits directly over Table1 and seems anchored so that I cannot move it "out of the way". Is this bahavior a restriction with Access as I do not have this problem with Excel or Word? Sheldon Potolsky
2
6071
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 monitors, and when I try to open 2 different forms from this database, it looks/feels like nothing is happening. If I look in the window list, the form IS open, but the user can't get to it. I open the same database at home on my two monitors, and the...
3
4763
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 with single monitor. But when working with two monitors only one half (vertical) of the popup is displayed. Its a complete popup with close,minimize buttons. Its in IE 6. Your help is appreciated. Regards,
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.