Working with Controls


Controls are the objects that you place on a form for users to interact with. If you've followed the examples in the previous hours, you've already added controls to a form. However, you'll be adding a lot of controls to forms, and it's important for you to understand all aspects of the process. After you learn about forms in this hour, the next two hours will teach you the ins and outs of the powerful controls provided by Visual C#.

Adding Controls to a Form

All the controls that you can add to a form can be found in the toolbox. The tool-box appears as a docked window on the left side of the design environment by default. This location is useful when you're only occasionally adding controls to forms. However, when doing serious form-design work, I find it best to dock the tool-box to the right edge of the design environment, where it doesn't overlap so much (if any) of the form I'm working with.

By the Way

Remember that before you can undock a toolbar to move it to a new location, you must make sure that it isn't set to Auto Hide.


There are category headings in the toolbox that you can expand and collapse. For most of your design, you'll use the controls in the Common Controls category. As your skills progress, however, you might find yourself using more complex and highly specialized controls found in the other categories.

You can add a control to a form in four ways, and you're now going to use three primary methods (you've already used the forth, which is to paste a copy of a control onto a form). Open the Picture Viewer project you created in the previous hour (or open the starting project provided at my website) and double-click frmOptions.cs in the Solution Explorer window to view the Options form in the designer.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net