Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have used a Panel on my WinForm. When I resize the form, or maximize or minimize the form, I wanted that the Panel should resize accordingly.

What property would I have to modify?


1 solution

You can use the anchor property for this. You first place the panel on the form and then enable the anchors to left, top, right and bottom. The panel will then resize relative to the form.[^][^]

Good luck!
Share this answer
optimus_prime1 13-Oct-10 9:39am    
I had already tried that. The panel I have used has TableLayoutPanel inside it. Panel's Auto size property is true. When the Panel is anchored to Top, Left (by default), the TableLayout forms rows and columns which are equal in width and height.

However, when I anchor the Panel to all the sides, the TableLayoutPanel inside the Panel doesn't form rows and columns which are equal in size. Any suggestions.
E.F. Nijboer 13-Oct-10 10:23am    
Try to set the anchors of the panel to left, top, right and bottom and auto size to false. For the inner TableLayoutPanel only set the anchors left and top and auto size to true.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900