How do I make sure a control is NOT inside a panel?
I have a few panels that take up a lot of space on my form, and sometimes when I drop a new control onto the form, Visual Studios will put that control inside that panel, which is开发者_运维问答 something I do not want. Is there any way to be sure that a control is not inside of a panel?
Use the Document Outline view to see a tree of the hierarchy.
Click "View" → "Other Windows" → "Document Outline".
The default shortcut is Ctrl + W, U.
In addition: Clicking a control in the designer and then clicking multiple times the Esc key will travel up in hierarchy, always selecting the parent, until the root form/control is being selected.
This could be a way to see visually which control a certain control is contained inside.
It has been a while since I've done winforms, but I believe that an item in a panel will have left and top properties that are relative to the origin point of the panel.
If my recollection is correct, then, you can inspect the location of the control, and it should be immediately clear that they are or are not relative to the form itself.
You could look in the Form1.Designer.cs
file, and see exactly what container is the parent of the control.
精彩评论