Hi, probably a very simple question, but I don't seem to find the solution my self.
I've added a panel in my c# project.
How can I switch in the designer between the main form layout and the panel(s)?
Also (but probably within the same answer as the above question) how can I add a textbox to a pecific panel or main form?
Regards.
UPDATE:
After some experimenting with this I came to this "workable" solution:
If you want to work with multiple panels which are being activated by a menu option here's a way which worked for me:
In my test case I have
1 Form: Form1
1 Menustrip: menuStrip1
1 MenuStrip option1: ToolStripMenuItem1 (activates Panel1)
1 MenuStrip option2: ToolStripMenuItem2 (activates Panel2)
1 Panel: Panel1
1 Panel: Panel2
I want the panels to fill the whole form when clicked from the menustrip option.
The problem was that I didn't understand that there's a simple way of selecting a panel in the GUI without moving them around.
Still this is not clear to me.
There's always one which is directly visible in VS.
So if you add the 2 panels to the main form, and give them Dock: Fill, you can't reach the main Form or the first added panel.
As the last added panel is visible.
You could think that you add all needed controls to the first panel before you add the second one.
This is Obviously true, but when you are starting a project, and do not know the scope of whisess or needs, than you need to alter the controls on a panel.
The work around to this I found in these methodes:
1) If you add the second panel, VS adds it to the first panel, instead of the Form.
So go to Form1.Designer.cs and find "this.Controls.Add(this.panel2);" and remove it from the controls list of Panel1 and add it to the controls list of the Form.
this.panel1.Controls.Add(this.panel2);
Remove and place in section Form1
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel2);
2) If you want to work on panel 1 but now see the panel 2 in the Form.cs[Design], just alter the sequense the panels are listed in the control list of the Form:
This shows the panel 1 as active panel:
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel2);
This shows the panel 2 as active panel:
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);