How to: Align a Control to the Edges of Forms at Design Time

You can make your control align to the edge of your forms by setting the value of the Dock property. This property designates where your control resides in the form. The Dock property can be set to the following values:

Setting Effect on your control
Bottom Docks to the bottom of the form.
Fill Fills all remaining space in the form.
Left Docks to the left side of the form.
None Does not dock anywhere, and it appears at the location specified by its Location.
Right Docks to the right side of the form.
Top Docks to the top of the form.

These values can also be set in code. For more information, see How to: Align a Control to the Edges of Forms.

Set the Dock property for your control at design time

  1. In the Windows Forms Designer in Visual Studio, select your control.

  2. In the Properties window, click the drop-down box next to the Dock property.

    A graphical interface representing the six possible Dock settings is displayed.

  3. Choose the appropriate setting.

  4. Your control will now dock in the manner specified by the setting.

See also