How to: Align and Stretch a Control in a TableLayoutPanel Control
You can align and stretch controls in a TableLayoutPanel with the Anchor and Dock properties.
Poznámka
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.
To align and stretch a control
Drag a TableLayoutPanel control from the Toolbox onto your form.
Drag a Button control from the Toolbox into the upper-left cell of the TableLayoutPanel control. The Button control is centered in the cell.
Set the value of the Button control's Anchor property to Left,Right. The Button control stretches to match the width of the cell.
Set the value of the Button control's Anchor property to Top,Bottom. The Button control stretches to match the height of the cell.
Set the value of the Button control's Dock property to Fill. The Button control expands to fill the cell.
Set the value of the Button control's Dock property to None. The Button control returns to its original size and moves to the upper-left corner of the cell. The Windows Forms Designer has set the Anchor property to Top, Left.
Set the value of the Button control's Anchor property to Bottom,Right. The Button control moves to the lower-right corner of the cell.
Set the value of the Button control's Anchor property to None. The Button control moves to the center of the cell.