J'ai un écran de veille simple que j'ai écrit, qui a été déployé sur tous les ordinateurs clients de notre société.Windows Screensaver Multi moniteur problème
Comme la plupart de nos PC ont deux moniteurs, je pris soin de veiller à ce que l'écran de veille a couru sur les deux écrans.
Cela fonctionne bien, mais sur certains systèmes, où l'écran principal ont été échangées contre (au moniteur gauche), l'écran de veille ne fonctionne que sur l'écran de gauche (primaire).
Le code incriminé est ci-dessous. Quelqu'un peut-il voir quelque chose que j'ai mal fait, ou une meilleure façon de gérer cela?
Pour info, le contexte de « cela », est la forme d'écran lui-même.
// Make form full screen and on top of all other forms
int minY = 0;
int maxY = 0;
int maxX = 0;
int minX = 0;
foreach (Screen screen in Screen.AllScreens)
{
// Find the bounds of all screens attached to the system
if (screen.Bounds.Left < minX)
minX = screen.Bounds.Left;
if (screen.Bounds.Width > maxX)
maxX = screen.Bounds.Width;
if (screen.Bounds.Bottom < minY)
minY = screen.Bounds.Bottom;
if (screen.Bounds.Height > maxY)
maxY = screen.Bounds.Height;
}
// Set the location and size of the form, so that it
// fills the bounds of all screens attached to the system
Location = new Point(minX, minY);
Height = maxY - minY;
Width = maxX - minX;
Cursor.Hide();
TopMost = true;