Snapping Controls to the Grid in Windows Forms
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
- Open the form. For details, see Displaying Windows Forms in the Designer.
- 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.
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