世界杯赔率_男乒世界杯决赛 - fjpftz.com

HOME> 世界杯冠军奖杯> 如何创建 MDI 子窗体 - Windows Forms

如何创建 MDI 子窗体 - Windows Forms

2025-05-29 19:35:13

当用户单击“ 新建 ”菜单项时,插入类似于以下内容的代码以创建新的 MDI 子窗体。

注释

在下面的示例中,事件处理程序处理Click事件以响应MenuItem2。 请注意,根据您的应用程序架构的具体情况,可能无法使用“新建”菜单项MenuItem2。

Protected Sub MDIChildNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click

Dim NewMDIChild As New Form2()

'Set the Parent Form of the Child window.

NewMDIChild.MdiParent = Me

'Display the new form.

NewMDIChild.Show()

End Sub

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();

}

private:

void menuItem2_Click(System::Object ^ sender,

System::EventArgs ^ e)

{

Form2^ newMDIChild = gcnew Form2();

// Set the Parent Form of the Child window.

newMDIChild->MdiParent = this;

// Display the new form.

newMDIChild->Show();

}

在 C++ 中,在 Form1.h 顶部添加以下 #include 指令:

#include "Form2.h"

最新发表
友情链接