Dual Screen Application and WPF

  • Thread starter Thread starter Sandra Smit
  • Start date Start date
S

Sandra Smit

Hi,

I'm making a dual screen application with WPF. I use the following code but
the weatherForcast form is not running on the second screen:

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

Window1 w1 = new Window1();
WeatherForecast weather = new WeatherForecast();

Screen s1 = Screen.AllScreens[0];
Screen s2 = Screen.AllScreens[1];

Rectangle r1 = s1.WorkingArea;
Rectangle r2 = s2.WorkingArea;

w1.Top = r1.Top;
w1.Left = r1.Left;

weather.Top = r2.Top;
weather.Left = r2.Left;

w1.Show();
weather.Show();

w1.Owner = weather;
}

What am I doing wrong?

Thanks,
Sandra
 
Back
Top