How do I determine what screen my application is running on?
Hmm, I don't think there is a built in way to get this, but it shouldn't be too hard to determine. Use the Screen class to find all the screens, loop through that list and compare its bounds with the location of the form.
Here is some untested code
Screen [] screens = Screen.AllScreens;
for(index = 0; index < screens.Length; index++) {
if (screens[index].Contains(this.Bounds))
return screens[index];
}
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).
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.
Take a look at these links:
These are in WinAPI. There may be .NET multiple monitor libraries/api calls, but if not, with these you can write your own.