简体   繁体   中英

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.

您可以查看Form1.Designer.cs文件,并确切地查看控件的父级容器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM