有没有办法告诉Visual Studio 2010在特定屏幕上启动Windows窗体应用程序(在调试时)。
答案 0 :(得分:3)
或者你可以试试这个。请注意,如果没有连接辅助屏幕,则没有错误检查。
using System;
using System.Windows.Forms;
namespace ScreenPositioning
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
#if DEBUG
var screen = Screen.AllScreens;
foreach (var s in screen)
{
if (!s.Primary)
{
this.Bounds = s.Bounds;
this.WindowState = FormWindowState.Maximized;
}
}
#endif
}
}
}
答案 1 :(得分:0)
更新:我在这里做了一些假设:
<强>答案:强>
不自动。您必须使用代码安排此操作,即设置VS以在调试时使用特定参数启动应用程序,然后将代码更改为执行以下操作:
var mainForm = new FormToShowNormally();
#if DEBUG
if(debugParameterOnCommandLine) {
mainForm = new FormToShowWhenDebugging();
}
#endif
Application.Run(mainForm);