This is what I have so far, but it only opens on the primary monitor. My goal specifically is to open the file on the monitor associated with the button that I click.
private void Form1_Load(object sender, EventArgs e)
{
Point btnTopLeft = new Point(15, 15);
foreach (var screen in Screen.AllScreens)
{
Button btn = new Button();
btn.Text = screen.DeviceName;
btn.Size = new Size(100, 23);
btn.Location = btnTopLeft;
btn.Tag = screen;
btn.Click += Btn_Click;
this.Controls.Add(btn);
btnTopLeft.Offset(0, btn.Height + 7);
}
}
private void Btn_Click(object sender, EventArgs e)
{
if (sender == null || !(sender is Button))
return;
var btn = (Button)sender;
if (btn.Tag == null || !(btn.Tag is Screen))
return;
var screen = (Screen)btn.Tag;
System.Diagnostics.Process.Start("explorer.exe", @"c:\");
}