0

I am trying to open winform on secondary screen with code below

ff.FormBorderStyle = FormBorderStyle.None;
ff.Left = sc[1].Bounds.Left; value 1366
ff.Top = sc[1].Bounds.Top;
ff.Height = sc[1].Bounds.Height;
ff.Width = sc[1].Bounds.Width;

Console.WriteLine(ff.Left); // output 1366

ff.Show();

Console.WriteLine(ff.Left); // output 50 

Why value got changed on show and because of that form open in primary screen. Even in Visual studio property window when i try to change x,y parameter of location, values updated to old values once i leave property cell. What can be the issue.

Hot Cool Stud
  • 1,145
  • 6
  • 25
  • 50
  • duplicate to http://stackoverflow.com/questions/1363374/showing-a-windows-form-on-a-secondary-monitor – AsfK Oct 21 '15 at 10:37
  • If you care about the position of the window on the screen then you *must* use the Load event. When it fires, the small changes to the window size due to user preferences are applied. And the changes due to the video DPI setting, forcing the form to rescale. Big changes. Only then can you align the window correctly. The StartPosition property is irrelevant. One of the few good reasons to use the Load event btw. – Hans Passant Oct 21 '15 at 11:02

2 Answers2

1

Try setting StartUpLocation parameter as "manual" for the ff form.

Huntt
  • 185
  • 5
  • 14
1

Set the StartPosition property of the form ff to Manual

Ramesh Babu
  • 405
  • 4
  • 10