0
Microsoft Paint(mspaint.exe)将启动最小化,没有问题。当我在c#(myWinForm.exe)中写入一个Windows窗体时,Process.StartInfo.WindowStyle命令被忽略(总是作为普通窗口启动)。以下代码的评论详细说明c#获取WinForm以编程方式启动时确认Process.StartInfo.WindowStyle
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
LaunchProcess("mspaint.exe");
LaunchProcess("myWinForm.exe"); // this process will not acknowledge the StartInfo.WindowStyle command (always normal window)
}
private void LaunchProcess(string filename)
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = filename;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; // how do I get a WinForm I wrote to acknowledge this line?
myProcess.Start();
}
}
如何配置myWinForm以便在从Process.Start()命令调用时确认ProcessWindowStyle?