- Software name:
- Visual studio 2017 official version (with offline installation package) official website simplified Chinese version
- Software size:
- Update time:
- 2017-03-14Download now
1. Open the visual studio 2017 software and enter the menu bar of the main interface of the software. Select in the menu bar“file”Command, you can see“newly build”、“project”To create a new project
2. In the new project interface, select the language asVisual C #, inCreate a new form application under windows classic desktop, and set the project name as“Add another project form”；
3. Enter the new project and set the form name property to“fm_main”, the form class is changed to formmain.cs
4. In the solution, select the project“Add another project form”Right click to add an existing item.
5. I found a drawing line project that I wrote before, and put theThis is form1Add a form to this project. It should be noted that the added files include the design file and code file of the form.Here, I need to add all three selected in the red box.
6. You can see that in the solution, there are three files we added.
7. Add a button in the main form to complete the function of calling the external form.
8. What we just added is“draw a straight line”The form1 form of this project, so I’ll go into this file and see what its namespace is“Drawing a line with a namespace”, which is not in the same namespace as this project.
9. Understand that even a form is not in the same project is very important, then write call function to use. The specific call function implementation code is as follows:
10. To compile and run the program, click“Call external form”。 Can I see the call“draw a straight line”How about this form.
The above is the method of adding existing forms to the project in visual studio. I hope you like it. Please continue to pay attention to developer.