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?