Reputation: 59
I have an application I've been working on and I built some functionality to be able to launch it and leave it running like a screen saver on a PC. It maximizes the primary window on the main monitor and then opens up a blackout black background window on all other monitors. The problem I'm having is that it does not seem to work well with more then two monitors. 3+ monitors and the blackout is not appearing on all of them.
Code to launch all the windows:
foreach (Screen s in Screen.AllScreens)
{
if (s != Screen.PrimaryScreen)
{
Blackout window = new Blackout();
window.Left = s.WorkingArea.Left;
window.Top = s.WorkingArea.Top;
window.Width = s.WorkingArea.Width;
window.Height = s.WorkingArea.Height;
window.Show();
}
else
{
BigScreenScreenSaver window = new BigScreenScreenSaver();
window.Left = s.WorkingArea.Left;
window.Top = s.WorkingArea.Top;
window.Width = s.WorkingArea.Width;
window.Height = s.WorkingArea.Height;
window.Show();
}
}
Upvotes: 0
Views: 95
Reputation: 1985
You need to use bounds, working area excludes taskbar and many other
foreach (Screen s in Screen.AllScreens)
{
if (s != Screen.PrimaryScreen)
{
Blackout window = new Blackout();
window.Left = s.Bounds.Left;
window.Top = s.Bounds.Top;
window.Width = s.Bounds.Width;
window.Height = s.Bounds.Height;
window.Show();
}
else
{
BigScreenScreenSaver window = new BigScreenScreenSaver();
window.Left = s.Bounds.Left;
window.Top = s.Bounds.Top;
window.Width = s.Bounds.Width;
window.Height = s.Bounds.Height;
window.Show();
}
}
Upvotes: 2