R – WinForm designer and right snapline for controls in container when resizing it

windows-forms-designerwinforms

Using Visual Studio 2008 WinForm designer, I have a container (form, panel, groupbox, whatever) and some controls in it.

The container is set to not automatically resize or dock in any way. When placing a control in the container I can use the snaplines to help in positioning the control.

However, the snaplines does not appear when I resize the container to the edge of the contained controls…

Is there a simple way to have the designer show me the snaplines of the contained controls when resizing the container?

Best Answer

The designer will only show the snap lines when moving a child control within a container. You can demonstrate it by moving a GroupBox around a Form and see that it shows snap lines when the GroupBox gets close to the edge of the Form, but if you were to resize the Form you won't see the snap lines appear.

If you're just looking to get all of the controls to line up in a uniform fashion, I'd suggest switching to SnapToGrid mode and using the grid lines to align your controls. You can set the SnapToGrid mode by going to Tools->Options->Windows Forms Designer->LayoutMode. Open your designer and you should see the grid appear, after that you can line your controls up with the grid.

Related Topic