【发布时间】:2016-08-10 09:19:00
【问题描述】:
我正在使用 Visual Studio 2012 在 C++ 中处理 Windows 窗体。我从这个链接Can't find Windows Forms Application for C++得到了帮助
我想要多个表格。我设计了 Form2 并将 Form2.h 包含在 Form1.h 中。但是当我打开 form2 时,它会立即出现并消失。 这是我的代码:
#include "Form2.h"
...
private: System::void button_Click(System::Object^ sender, System::EventArgs^ e){
Form2 frm2;
frm2.Show();
//this->Hide();
//this->Close();
}
如果我使用
this->Hide();
这两个表单将隐藏,如果我关闭 form1
this->Close();
form2 也会关闭。
我想独立打开和关闭表单。我必须做什么?
任何帮助将不胜感激
【问题讨论】:
-
你把代码打开C++的文件了吗?
-
@Eliyahu-Shmuel 我已经使用提到的链接在 C++ 中处理表单。打开第一个表单我使用
Application::Run(%form);