1
這是我到目前爲止,但它只在主監視器上打開。我的目標主要是在與單擊按鈕相關的監視器上打開文件。如何以最大窗口大小從資源管理器打開文件到特定監視器上?
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:\");
}
你想「打開一個文件」?或者你只是指在特定目錄中打開資源管理器? –
[啓動應用程序並將其發送給第二個監視器?](http://stackoverflow.com/questions/3750113/launch-an-application-and-send-it-to-second-monitor) – Huntt