I have a screen that is divided by several separation containers. One of them contains rectangles that I created custom components, these "rectangles" are hospital beds. I would like to give users the ability to switch between this “custom component view” and the “datagrid” view.
So, I created the pnlPatients panel, which I give to the size of the shared container with custom components. When the user selects "Change View", the program should switch between the two layouts.
Code: Attempt 1:
if (pnlPatients.Visible)
pnlPatients.Hide();
else
{
pnlPatients.Show();
pnlPatients.BringToFront();
}
Attempt 2:
pnlPatients.Visible = !pnlPatients.Visible;
pnlPatients.Invalidate();
It is strange that both attempts work like this:
" ".
, .
, .
, . : TRUE FALSE. - , TRUE, .
- ?
: , :
pnlPatients.Visible = !pnlPatients.Visible;
if (pnlPatients.Visible)
{
pnlPatients.BringToFront();
}
else
{
pnlPatients.SendToBack();
}