Buck
Buck

Reputation: 599

Winforms: What Determines if Docking Moves Other Controls

For example, within a TabPage, I have a DataGridView that is docked "Fill". If I set the dock property of a UserControl to the the "Right" position, the DataGridView moves to the left as expected. If I replace the UserControl with a Panel or Label (also docked to the "Right" within the TabPage) the DataGridView does not make room. The Panel or Label just overlay the DataGridView. I tried stackoverflow and did some reading but did not see any rules (yet). Thanks.

Upvotes: 0

Views: 350

Answers (1)

Hans Passant
Hans Passant

Reputation: 942040

Their Z-order. You can manipulate it with the Bring to Front and Move to Back context menu items, right-click a control to see the menu.

It is much clearer when you use the View + (Other Windows) + Document Outline window, it lists them in Z-order underneath their container. And allows you to drag+drop the controls to change their order, you see the effect in the designer immediately.

Upvotes: 2

Related Questions