/*____________________________________________________ W O R K I N G W I T H M D I P R O J E C T S Ron Kessler Created 11/05/2014 This shows how to create a Multiple Document Inteface project like MS Office uses. A main parent form controls the child forms inside. Also shows how to work with drop down menus _____________________________________________________ */ //************ADD THE FORMS WE WILL ACCESS FROM HERE************* #include "Customers.h"; #include "frmManager.h"; #include "General.h"; //use the view menu to display the form they want private: System::Void View_Customer_Click(System::Object^ sender, System::EventArgs^ e) { //---you must tell the customers form who its parent is Form^ myCustomers = gcnew Customers; myCustomers->MdiParent=this; myCustomers->Show(); } private: System::Void View_Manager_Click(System::Object^ sender, System::EventArgs^ e) { //---you must tell the manager form who its parent is Form^ myManager = gcnew frmManager; myManager->MdiParent=this; myManager->Show(); } #pragma region WINDOW MENU //how to tile/cascade forms inside the MDI parent form private: System::Void Window_Vert_Click(System::Object^ sender, System::EventArgs^ e) { this->LayoutMdi(MdiLayout::TileVertical); } private: System::Void Window_Horizontal_Click(System::Object^ sender, System::EventArgs^ e) { this->LayoutMdi(MdiLayout::TileHorizontal); } private: System::Void Window_Cascade_Click(System::Object^ sender, System::EventArgs^ e) { this->LayoutMdi(MdiLayout::Cascade); } #pragma endregion #pragma region FILE MENU //close the active form then the whole app using Application::Exit(); private: System::Void File_Close_Click(System::Object^ sender, System::EventArgs^ e) { //---find the active form and close Form^ myActiveForm = this->ActiveMdiChild; //this is pointing to the active form not creating one if(myActiveForm != nullptr) //you cannot close something that does not exist myActiveForm->Close(); } private: System::Void File_Exit_Click(System::Object^ sender, System::EventArgs^ e) { Application::Exit(); //use this for multi-form apps } #pragma endregion