Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set Anchors for controls wrapped inside controls?

Status
Not open for further replies.

emeraldtea

Programmer
Mar 4, 2003
16
US
In an application, I have nested controls(controls within controls and they are from different classes).
The Form form1 is the base. In form1, I have a panel--panel1. In anel1, I will add another panel--panel2 with several labels.(I use panel2 to group these labels.) panel2 is from another class different from form1.

For panel1, setting Anchor is straightforward.
I am wondering how I can set Anchors of labels in panel2 so that when form expands, labels in panel2 expands according?

I tried to set AnchorStyles.Left|AnchorStyles.Right for label2 in the form1. But it did not work. label2 doesn't expand.

Is this caused by nested controls since lable2 is in panel2, which is wrapped in panel1 of form1?

How to set Anchors for controls wrapped inside controls?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top