What is the difference between Show/Hide and BringToFront/SendToBack? In which situation we should use one pair instead of the other?
Show()
is equivalent for setting Visible = true
. It does not change control's Z-order. If control is closed by some other control, which is in front of Z-order, user still will not be able to see your control.
BringToFront()
changes control's Z-order (brings to front), but does not change it's visibility. If control is hidden, then it will remain hidden. But when you make your control visible, it will appear at the front of all other controls.
Same with Hide()
(makes control invisible, but does not change Z-order) and SendToBack
(does not change visibility, but brings control to back).
These are completly different methods.
Show()
: shows the control on the view, by initializing the content of it before.
BringToFront
and SendToBack
act on Z-order
of that control in regard of others.
But the control is already visible.
Hints from MSDN on BringToFront:
Brings the control to the front of the z-order.
and on Show:
Displays the control to the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With