Reputation: 13
For some reason when I use code such as
this.panel.BringToFront();
this.panel.show();
this.panel.visible = true
And I set the other panels to false, etc.
Current Code which shows the bottom panel 3 but blanks out for panel 4 and 5.
private void button10_Click(object sender, EventArgs e)
{
this.panel3.Location = this.panel3.Location;
this.panel3.Show();
this.panel3.BringToFront();
this.panel4.SendToBack();
this.panel4.Hide();
this.panel5.SendToBack();
this.panel5.Hide();
}
private void button4_Click(object sender, EventArgs e)
{
this.panel5.Location = this.panel5.Location;
this.panel5.Show();
this.panel5.BringToFront();
this.panel4.SendToBack();
this.panel4.Hide();
this.panel3.SendToBack();
this.panel3.Hide();
}
private void button3_Click(object sender, EventArgs e)
{
this.panel4.Location = this.panel4.Location;
this.panel4.Show();
this.panel4.BringToFront();
this.panel5.SendToBack();
this.panel5.Hide();
this.panel3.SendToBack();
this.panel3.Hide();
}
This doesnt work tho and when I click button3 and button 4 it displays none of the panels and when I click on button10 it displays panel3(the bottom panel) which it is supposed to but why doesn't it display panels 4 and 5.
I have also made the buttons do this and it has the same error:
private void button4_Click(object sender, EventArgs e)
{
panel5.Visible = true;
panel4.Visible = false;
panel3.Visible = false;
}
But this also doesn't work. I have asked some people on discord but no one seems to know anything these days and just get roles for free which is stupid but ye that's why I am here asking for help.
Upvotes: 1
Views: 7154
Reputation: 162
It seems you have added the panels inside the other panel which you want to display. Show it doesn't show the proper panel when you click the buttons.
Ensure the parent of your panels should be same. If the parent of your panels are different, then change the parent of the panels are same.
Upvotes: 0
Reputation: 929
When you add panels on other panels, It goes inside the first panel. When you try panel.BringToFront()
it does not work because the first panel is in the back.
Here is what you can do...
Go to View -> Other Windows -> Document Outline
Then try to get panels to the same level and move the panels using arrow keys instead of dragging using the mouse.
Upvotes: 8