从一个实例运行另一个应用程序实例。

时间:2012-09-16 13:23:25

标签: c# .net winforms

就像Sticky Notes中的Windows 7一样,我想创建一个mainForm,只要用户点击ButtonbtnAdd,就会添加一个新表单。此新表单应具有mainForm的所有属性。

我试过了:

private void btnAdd_Click (object sender, EventArgs e)
{
    mainForm newForm=new mainForm();
    newForm.show();
}

但即使这是创建类似于mainForm的表单,我们会在关闭mainForm时关闭。

1 个答案:

答案 0 :(得分:1)

我认为这就是你要找的......

Answer from another thread.

已复制:

private void button1_Click(object sender, EventArgs e)
{
    Process p = new Process();
    p.StartInfo.FileName = Application.ExecutablePath;
    p.Start();
}