The implementation method is as follows:
1. Design first, put a panel on the left, put a panel on the right (named pnlmain), adjust the size, and place two buttons on the left panel (the same applies to multiple buttons)
2. Write the method in the button
Click the "check naming conventions" button (I wroteCodeTest Tool) write the following method
Private void btnnamecheck_click (Object sender, eventargs E)
{
This. pnlmain. Controls. Clear (); // initialize the main panel
Namerule Nr = new namerule (); // instantiate the form to be displayed in pnlmain (namerule is a new form)
Nr. toplevel = false; // set attributes
Nr. Show (); // display form
This. pnlmain. Controls. Add (NR); // Add from to pnlmain
}
In this way, click the naming convention check button to display the new form in the panel.
Similarly, write the same method in another button to open another form.
Private void btncodelinecheck_click (Object sender, eventargs E)
{
This. pnlmain. Controls. Clear ();
Codelinecount CLC = new codelinecount ();
CLC. toplevel = false;
CLC. Show ();
This. pnlmain. Controls. Add (CLC );
}