I have a little problem with two panels that are on top of eachother with the exact same Size.
What I am trying to do is with 2 buttons to choose wich panel that will be visible and not visible.
So what should happen is that only one panel can be seen at a time.

The Form starts with default panel43->Visible = true;

If I now press button37, panel41 will be seen but now when I press button36, both panels is Visible = false; it seems because I will see the background color of the Form, so no panels is Visible.
I might wonder what this could depend on...

private: System::Void button36_Click(System::Object^  sender, System::EventArgs^  e) 
{

	 panel43->Visible = true;			 
	 panel41->Visible = false;
		 
}
private: System::Void button37_Click(System::Object^  sender, System::EventArgs^  e) 
{

          panel41->Visible = true;			 
	 panel43->Visible = false;
					 
}

I have a little problem with two panels that are on top of eachother with the exact same Size.
What I am trying to do is with 2 buttons to choose wich panel that will be visible and not visible.
So what should happen is that only one panel can be seen at a time.

Instead of keeping two buttons for this task, why not use two radio buttons? This would be more appropriate as you want only one of the panels to be visible at a time.

This seems to be a feature in VS. If you look into the Form's InitializeComponent() code, you'll see that the Designer has added the second panel as a control of the first one, i.e. something like: this->panel43->Controls->Add(this->panel41); This arrangement seems to occur acutomatically whenever the two panels overlap in the Form Designer. So maybe you have to devise something else instead of overlapping panels.

Yes, thats right. I will have to find another solution. I will experiment on that.
Thank you for the information.

j

This seems to be a feature in VS. If you look into the Form's InitializeComponent() code, you'll see that the Designer has added the second panel as a control of the first one, i.e. something like: this->panel43->Controls->Add(this->panel41); This arrangement seems to occur acutomatically whenever the two panels overlap in the Form Designer. So maybe you have to devise something else instead of overlapping panels.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.