views:

510

answers:

1

This is something that's been driving me up the wall: how can i get the windows forms designer to provide pixel snapping for the horizontal and vertical centers of the form I'm working on?

+2  A: 

Visual Studio provides a number of tools to assist in aligning groups and sizing groups of controls in a form. These features are accessed using the layout toolbar. To display the layout toolbar right click on any part of the standard Visual Studio Toolbar and select Layout from the drop down menu. The resulting toolbar will appear as follows:

The Visual Studio Layout Toolbar alt text

Select a group of components and click on the various buttons in the toolbar to see the effect. For example, all the controls can be left or right aligned and resized to the same size, width or height. It is also possible to equally space the controls, and then increase or decrease the spacing used to separate the controls. It is also possible place controls on top of one another and change which control appears on top of the stack (this can also be done in Visual Basic code using the BringToFront() and SendToBack() methods of the respective controls).

All together, the selection of controls allows just about any uniform layout to be achieved from a group of controls in a form.

http://www.techotopia.com/index.php/Designing%5FForms%5Fin%5FVisual%5FStudio

5th and 6th icon from the right end will do the trick for you:

  • Center Horizontally
  • Center Vertically

Not quite automatic, but still works.

Eric P
Thanks! :) ()()
RCIX