Int Note: Kin Lib uses child forms

Applications that have a main window which contain one or more child windows are called Multiple Document Interface (MDI)

For the parent form (for instance the form created when creating a new project) set the IsMdiContainer property to true. Add a menu strip to the form and create menu items to allow the user to open new child forms.

To create a child form

Create a new form as normal


	CellsStatusForm1->MdiParent = this;
	CellsStatusForm1->Show();

Then see page 163 of Visual Studio 2008 for dummies…

Detecting When Child Forms Close

When you create and open the child form

	MyChildForm = gcnew frmBarGraphs();
	MyChildForm->FormClosed += gcnew FormClosedEventHandler(this, &frmMain::MyChildForm_FormClosed);
	MyChildForm->MdiParent = this;
	MyChildForm->Show();
And the callback function that will be called

	private: void MyChildForm_FormClosed(System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e)
	{
		//Do this if you want to be able to get some values back from the form before it closes:
		frmMyChildForm ^ClosingForm = dynamic_cast<frmMyChildForm^>(sender);

		if (e->CloseReason == System::Windows::Forms::CloseReason::UserClosing)
		{
			//Only do if user has closed child form
			//(we don't want this if form is closing because the application is closing)
			SomethingIWantToStore = ClosingForm->SomeValueOfMine;

			//Update our menu bar or whatever to reflect the form being closed

		}
       }
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.