【问题标题】:How do I make a button make a form in another form?如何使按钮以另一种形式制作形式?
【发布时间】:2016-01-30 07:20:31
【问题描述】:

因此,在我目前的情况下,我将桌面表单设置为通过 MDI.Container 打开该表单内的内容。

我有一个在桌面表单启动时自动打开的表单。阅读该表单后,您将单击表单按钮上的“下一步”,它应该在同一个 mdi 容器中打开新表单,但它会在我实际操作系统的新窗口中打开它。我希望它在桌面表单的原始 MDI 容器中打开。 如果你能帮助我,请做!

我尝试了以下方法:

this.IsMdiContainer = true;
Welcome welcome = new Welcome();
welcome.MdiParent = this;
welcome.Show();

【问题讨论】:

  • 如果你使用MDI,你应该阅读并理解以下ParentOwner

标签: c# operating-system


【解决方案1】:

这会有帮助吗?我不确定你的问题

// C#
protected void MDIChildNew_Click(object sender, System.EventArgs e)
{
    Form2 newMDIChild = new Form2();
    // Set the Parent Form of the Child window.
    newMDIChild.MdiParent = this;
   // Display the new form.
   newMDIChild.Show();
}

【讨论】:

    【解决方案2】:

    问题是您在代码中使表单 ismdicontainer = true 您应该在设计时使表单 ismdicontainer 为 true,而不是在运行时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多