Skip to Main Content
Professional Visual Studio® 2008
book

Professional Visual Studio® 2008

by Nick Randolph, David Gardner
July 2008
Intermediate to advanced content levelIntermediate to advanced
1026 pages
27h 59m
English
Wrox
Content preview from Professional Visual Studio® 2008

8.3. Adding and Positioning Controls

You can add two types of controls to your Windows Forms: graphical components that actually reside on the form itself, and components that do not have a specific visual interface displaying on the form.

You add graphical controls to your form in one of two ways. The first is to locate the control you want to add in the Toolbox and double-click its entry. Visual Studio 2008 will place it in a default location on the form — the first control will be placed against the top and left borders of the form, with subsequent controls tiled down and to the right.

The second method is to click the entry on the list and drag it onto the form. As you drag over available space on the form, the mouse cursor will change to show you where the control will be positioned. This enables you to directly position the control where you want it, rather than first add it to the form and then move it to the desired location. Either way, once the control is on the form, you can move it as many times as you like, so it doesn't really matter how you get the control onto the form's design surface.

There is actually one other method to add controls to a form — copy and paste a control or set of controls from another form. If you paste multiple controls at once, the relative positioning and layout of the controls to each other will be preserved. Any property settings will also be preserved, although the control names may be changed.

When you design your form layouts in SnapLines ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Visual Studio® 2010

Professional Visual Studio® 2010

Nick Randolph, David Gardner, Michael Minutillo, Chris Anderson

Publisher Resources

ISBN: 9780470229880Purchase book