![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
Table 3.1 lists some other form properties you need to know about. Note that you can view information about any property by selecting it in the Property window and pressing F1. Moving, Sizing, And Aligning ControlsOnce you have placed controls on a form, you will probably need to tweak and fine-tune their sizes and positions. A sloppily constructed formone with poorly aligned and inconsistently sized controlswill not impress your customers. To work with controls on a form, you must select the control or controls that interest you. To select multiple controls, click on the first one, then press and hold the Shift key while you click on the others. As I mentioned previously, selected controls display handles on their edges. If only one control is selected, its handles are dark. If two or more controls are selected, the handles on each control are whiteexcept for the last one that was selected, which has dark handles.
When you have one control selected, you can change its size by pointing at one of its handles and dragging the outline to the desired size. As you drag, a small window displays the controls size in twips. You can change the selected controls position by pointing to the control (not a handle) and dragging. As you do so, a small window displays the position of the control within the form. As with control size, position is expressed in twips and gives you the horizontal and vertical distance between the controls top left corner and the top left corner of the form.
With more than one control selected, you can move them as a group, allowing the individual controls to retain their positions relative to each other. You cannot, however, change the size of multiple selected controls. Aligning Controls Alignment of controls is an important design issue. The Visual Basic design grid greatly simplifies basic alignment tasks by displaying a grid of dots on the design form. Visual Basics normal behavior is to snap controls to this grid. In other words, when you are moving or sizing a control, its edges always align with the gridthey cannot take intermediate positions. By aligning controls to the grid, it is relatively simple to ensure that a group of controls are all the same size and are also equally spaced. You can control the design grid using the Options dialog box, which you display by selecting Options from the Tools menu. In the dialog box, click on the General tab and look for the Form Grid Settings section. You have several options to set here:
Changing the width or height of the grid does not affect controls already on the form; only controls added after the grid has been modified will snap to the new settings. The same is true of turning alignment on or off. A more powerful way to align controls is with the Align command on the Format menu. First, select two or more controls that you want to align by holding the Shift key down while clicking on the controls. Be sure to click last on the control you want the others to align withit will display dark handles while the others will display white ones. Then select Align from the Format menu and choose the desired alignment. Here are the options:
Modifying Control Size And Spacing Visual Basic also has a command that simplifies the task of making a group of controls all the same size. Select the controls, again making sure that the master control is the last selection. Then select Make Same Size from the Format menu and choose which dimension(s) to make the same as the master control. To make the size of the selected controls snap to the design grid, select Size to Grid from the Format menu. Visual Basic also provides commands that simplify the task of setting the spacing between controls. You can work with vertical or horizontal spacing, as required. Start by selecting three or more controls, then select either Vertical Spacing or Horizontal Spacing from the Format menu. Regardless of the spacing you select, your choices are the same:
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |