MDI adding childform from different project?
I have 3 projects created by someone else.
So.. 开发者_开发问答all three of them has form1.
I want to create a new window form like MDI and place them as a child.
I can't add them as the namespaces are different. Is it possible to add like this?
Coz.. the example shown is.. add new form under the current project.
I don't see why this wouldn't work.
-Make sure that the IsMdiContainer
property of your new Form is set to true
-Add references to the other projects
-Add this code in your new windows form (the MDI parent) (assuming WindowsFormsApplication2 is the name of one of the projects):
//Create a new instance of the MDI child form
WindowsFormsApplication2.Form1 childForm = new WindowsFormsApplication2.Form1();
//Set parent form for the child window
childForm .MdiParent=this;
//Display the child window
childForm .Show();
Repeat for your other projects.
精彩评论