I'm working on a control, which contains a TableLayoutPanel
.
The panel contains X rows and Y columns - where each cell is the same size.
Each cell contains a Control
When the parent controls is being resized, I want each cell to be resized as well, and keep the same size to each other.
I've tried to set the Controls'
Anchor
when added to the cell:
control.Anchor = AnchorStyles.Left | AnchorStyles.Top |
AnchorStyles.Right | AnchorStyles.Bottom;
But this only makes the bottom row and the right most column expand.
Using designer or code, you can set
SizeType
of the columns and rows toPercent
and assign same percentage value for their size. Also setDock
property of your controls toFill
.For example: