This question already has an answer here:
I have an application in which there is a form which I want to show on second screen.
Mean If application is running on screen A and when I click on menu to show Form it should display on Screen B and same with if application is running on screen B and when I click on menu to show Form it should display on Screen A.
I used this for an XNA 4 Dual Screen Application (Full Screen XNA Game Window + WinForm)
In the Form_Load() method, place the following code:
You need to use the
Screen
class to find a screen that the original form is not on, then set the second form'sLocation
property based on that screen'sBounds
.For example:
This will work for any number of screens.
Note that it is possible that the video card is configured so that Windows sees one large screen instead of two smaller ones, in which case this becomes much more difficult.
On the OnLoad method change the Location of the window.
Below is a function allowing you to display a form on any monitor. For your current scenario you can call this
showOnMonitor(1);
.Essentially you have to get screen information from
Screen.AllScreens
and then get the dimensions of each, then place your form where you need itNote don't forget to do validation to ensure you actually have two screens etc else an exception will be thrown for accessing
sc[showOnMonitor]