Question

As the question suggestions, should I be checking the Rectangle to set a Form.Location (which is taken from a Settings file) based on:

1.

if (settings.X <  Screen.PrimaryScreen.WorkingArea...)
{
  // Set the form's Location based on the settings object
}

or

2.

int width = 0;
foreach (Screen screen in Screen.AllScreens)
{
    width += screen.WorkingArea.Width;
}

if (settings.X <  width...)
{
  // Set the form's Location based on the settings object
}

Or is there a simple one liner that does the task of #2? I'm working on dual monitors, but the user base may have any number of configurations.

Was it helpful?

Solution

Perhaps my answer on this different question helps in this case too:

Restoring Window Size/Position With Multiple Monitors

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top