C# WinForms: I am designing my form and I have a couple of TableLauots. so I design my first tablelayout, throw it on the panel and set Dock->Top ... then I design my second one and do the same and set Dock->Top, it goes to Top again and good, it places under the previous one that was on top...I design the third one and set its dock.top and good it is under second one which is under first one...but I dunno what is the diffrence for the forth one that when I set its dock.top, it changes the order of the other three ones and get places some where in between them, it does not get placed under the third one...any idea what should I look in to?
Select the control in the designer. In the Properties window, select the arrow to the right of the Dock property. Select the button that represents the edge of the container where you want to dock the control. To fill the contents of the control's form or container control, press the center box.
Anchor refers to the position a control has relative to the edges of the form. A textbox, for example, that is anchored to the left edge of a form will stay in the same position as the form is resized. Docking refers to how much space you want the control to take up on the form.
The TableLayoutPanel control supports the Anchor and Dock properties in its child controls.
Docking refers to how much space you want the control to take up on the form. If you dock a control to the left of the form, it will stretch itself to the height of the form, but its width will stay the same.
It depends on the order you have added those controls to their container. The earlier added control will be the topper one and so on ...
To fix it, "Cut" the forth control and "Paste" it again to the container and it will take the desirable place.
Another way to fix it is by modifying the designer file code to re-order the adding of those controls to their container.
Right click on the Controls and select "Send to Back" or "Bring to Front", or use the Document Outline Window to rearrange the Z-Order of the items. Document Outline helps a lot when creating WinForms things with lots of controls.
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