954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

panel->Visible = true; /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.

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;
					 
}
Jennifer84
Posting Pro
564 posts since Feb 2008
Reputation Points: 10
Solved Threads: 1
 
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.

Jishnu
Posting Pro
518 posts since Oct 2006
Reputation Points: 193
Solved Threads: 25
 

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.

mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

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.

Jennifer84
Posting Pro
564 posts since Feb 2008
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You