How do I determine what screen my application is running on?
This should get you started. Get a Button and a listbox on a Form and put this in the Button_Click:
listBox1.Items.Clear();
foreach (var screen in Screen.AllScreens)
{
listBox1.Items.Add(screen);
}
listBox1.SelectedItem = Screen.FromControl(this);
The answer is in the last line, remember that a Form is a Control too.
The System.Windows.Forms.Screen class provides this functionaility.
For example:
Screen s = Screen.FromPoint(p);
where p is a Point somewhere on your application (in screen coordinates).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With