This documentation is archived and is not being maintained.

Snapping Controls to the Grid in Windows Forms

Visual Studio .NET 2003

Using the SnapToGrid property, you can finely govern where controls are placed on a form. Controls added to a form or moved on a form are automatically aligned to the rows and columns of the Forms Designer's grid when this property is set to true.

To snap all controls to the grid

  1. Open the form. For details, see Displaying Windows Forms in the Designer.
  2. In the Properties window, set SnapToGrid equal to true. All controls now align themselves along the points on the grid.

You can snap individual controls to the grid by locking them in place. However, while they are locked, they cannot be moved or resized. For more information on locking controls, see Locking Controls to Windows Forms.

See Also

Windows Forms Controls | Controls by Category | Adding Controls to Windows Forms | Arranging Controls on Windows Forms | Labeling Individual Windows Forms Controls and Providing Shortcuts to Them | Controls You Can Use on Windows Forms | Windows Forms Controls by Function | Creating Windows Forms

Show: