Dovrei usare Screen.PrimaryMonitor o Screen.AllScreens per l'impostazione Form.Location?

StackOverflow https://stackoverflow.com/questions/944223

  •  09-09-2019
  •  | 
  •  

Domanda

Mentre i suggerimenti di domanda, dovrei essere il controllo del rettangolo per impostare un Form.Location (che è tratto da un file di impostazioni) in base a:

1.

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

o

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
}

O c'è un semplice rivestimento che fa il compito di # 2? Sto lavorando su due monitor, ma la base di utenti può avere un qualsiasi numero di configurazioni.

È stato utile?

Soluzione

Forse la mia risposta su questa diversa domanda aiuta anche in questo caso:

Ripristino Window Size / Ruolo con più monitor

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top