ADDING CONTROLS

The Windows Forms Designer allows you to add controls to a form in several ways.

First, if you double-click a control on the Toolbox, Visual Studio places an instance of the control on the form in a default location and at a default size. You can then use the mouse to move and resize the control.


NOTE
When you use this method, the new control is placed inside the currently selected container on the form. If the currently selected control is a GroupBox, the new control is placed inside the GroupBox. If the currently selected control is a TextBox that is inside a Panel, the new control is placed inside the Panel.

Second, if you click a control in the Toolbox, the mouse cursor changes while the mouse is over the form. The new cursor looks like a plus sign with a small image of the control’s Toolbox icon next to it. If you click the form, Visual Studio adds a control at that location with a default size. Instead of just clicking, you can click and drag to specify the new control’s location and size. After you place the new control, the mouse returns to a pointer cursor so you can click existing controls to select them.


NOTE
If you hold down the Control key when you click or drag on the form, the designer adds the new control to the form and keeps the control’s Toolbox tool selected so you can add another instance of the control. For example, suppose you need to create a series of TextBoxes to hold a user’s name, street, city, state, and ZIP code. Select the TextBox tool in the Toolbox. Then you can quickly use Ctrl+Click five times to create the TextBoxes. Press the Esc key to stop adding TextBoxes and then drag them into their correct positions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.179.252