There are 3 panels pnlPanel0, pnlPanel1, pnlPanel2 with the same size and the same position.
With buttons “left” or “right” I need to change visibility of each panel.
With pnlPanel0 (contains labels) and pnlPanel2 (contains buttons) – OK.
But with pnlPanel1 (contains ListView):
curLayer == 1: after pnlPanel1.Visible = true;
panel with ListView is still invisible.
But if pnlPanel1 is not intersected with pnlPanel0 and pnlPanel2 – OK.
Why?
May be in this case is something wrong with “Bring to front”/”Send to back”?
Is there another safe and issue-free solution?
if (curLayer == 0)
{
pnlPanel0.Visible = true;
pnlPanel1.Visible = false;
pnlPanel2.Visible = false;
}
else if (curLayer == 1)
{
pnlPanel0.Visible = false;
pnlPanel1.Visible = true;
pnlPanel2.Visible = false;
}
else if (curLayer == 2)
{
pnlPanel0.Visible = false;
pnlPanel1.Visible = false;
pnlPanel2.Visible = true;
}
MessageBox.Show(Convert.ToString(pnlPanel1.Visible)); // always false
.NET CF 3.5/WinForms/VS 2008/WinCE
I’ve got a form with about 7 Panel controls on it.
At
Form_Load, all Panels are set to.Dock = DockStyle.Fill;.Further, all Panels share this same
GotFocusevent:Do you need to do something with a particular panel? OK, then take a look at this version: