Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am developing a windows desktop application dual monitor where i need to display my form sometimes on Primary Screen and sometimes on secondary,
Which works fine but when i display it on my secondary Screen i want it to be displayed on centre of my screen which is not working here is my code:

C#
if (Screen.AllScreens.Length > 1)
 myForm.Location = Screen.AllScreens[1].WorkingArea.Location;
 myForm.StartPosition = FormStartPosition.Manual; // because i wrote manual it is displayed on Top left of my secondaryScreen which is ok
 myForm.show();

but i want to diplay it on centre so i wrote
C#
  myForm.StartPosition = FormStartPosition.CentreScreen;
//it is not working again a form is displayed on Centre of PrimaryScreen..

any idead why?????
Posted
Updated 14-Jul-15 22:06pm
v2
Comments
sreeyush sudhakaran 9-Aug-15 7:12am    
It is different scenario while working with single and multi displays , this problem is pretty much solved in WPF windows application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900