Bagikan melalui


How to: Arrange Controls with Snaplines and the Grid in Windows Forms

Using the layout features of Visual Studio, you can precisely direct where controls are placed on a form. Controls added to a form or moved on a form can be automatically aligned to the rows and columns of the Windows Forms Designer's grid, or you can align controls by using the snaplines feature.

Note

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 snap all controls to the grid

  • Select the SnapToGrid layout mode in the Windows Forms Designer Options dialog box.

    For more information, see General, Windows Forms Designer, Options Dialog Box. 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 about locking controls, see How to: Lock Controls to Windows Forms.

To align controls using snaplines

See Also

Tasks

Walkthrough: Arranging Controls on Windows Forms Using Snaplines

How to: Add Controls to Windows Forms

Reference

General, Windows Forms Designer, Options Dialog Box

Windows Forms Controls by Function

Other Resources

Windows Forms Controls

Arranging Controls on Windows Forms

Labeling Individual Windows Forms Controls and Providing Shortcuts to Them

Controls to Use on Windows Forms