bricklayer137
bricklayer137

Reputation: 384

Anchoring controls to a parent control that is not a form using C#

I have a panel being used like a subform. What I would like is to restrict the panel to some maximum size. When the form is maximized or resized, the subform is resized only to some maximum height and width. Couldn't find a property to limit the size of the panel so I did it manually by handling its resize event. That's okay because it's only one control.

The problem is with the controls inside the panel. I thought it was simply a matter of anchoring some of the controls to the panel. Wrong! It looks like they're being anchored to the form. Any solultions besides manually resizing all the controls?

Upvotes: 1

Views: 178

Answers (1)

Chris Taylor
Chris Taylor

Reputation: 53699

Make sure that the controls have been added to the Controls collection of the Panel. If they have, your scenario should work as expected.

Upvotes: 1

Related Questions