|
|
|
![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
Form Designers And Code Windows The last parts of the IDE that well take a look at in our overview are form designers and code windows, which appear in the center of Figure 2.8. (The form designer displays the current form under design, complete with command button, and the code window displays the code for the Command1_Click() procedure.)
Form designers are really just windows in which a particular form appears. You can place controls into a form simply by drawing them after clicking the corresponding controls tool in the toolbox. Code windows are similarly easy to understand: you just place the code you want to attach to an object in the code window (to open an objects code in the code window, just double-click that object). There are two drop-down list boxes at the top of the code window: the left list lets you select the object to add code to, and the right list lets you select the procedure to add (all the methods the object supports appear in this list). That completes our overview of the IDE. Lets get into the actual meat of the chapter now, task by task. Immediate SolutionsSelecting IDE Colors, Fonts, And Font SizesThe Visual Basic IDE comes with all kinds of preset colorsblue for keywords, green for comments, black for other code, and so on. But as when you move into a new house, you might want to do your own decorating. Visual Basic allows you to do that. Just open the Options box by clicking the Options item in the Visual Basic Tools menu, and click the Editor Format tab, as shown in Figure 2.9.
Here are the text items whose colors you can select:
To set a particular type of texts color and background color, just select the appropriate color from the drop-down list boxes labeled Foreground and Background, and click on OK. You can also set text font and font sizes in the same wayjust specify the new setting and click on the OK button to customize the text the way you want it. Aligning, Sizing, And Spacing Multiple ControlsVisual Basic is very...well...visual, and that includes the layout of controls in your programs. If youve got a number of controls that should be aligned in a straight line, it can be murder to have to squint at the screen, aligning those controls in a line down to the very last pixel. Fortunately, theres an easier way to do it:
Sizing handles, the eight small boxes that you can grasp with the mouse to resize a control, appear around all the clicked controls. The sizing handles appear hollow around all but the last control you clicked, as shown in Figure 2.10; the last control you clicked has solid sizing handles, and it will act as the key control. The other controls will be aligned using this key controls position. To align all the selected controls to the same left, right, or center position of the key control, you continue with these steps:
To size all selected controls the same as the key control, follow Steps 1 and 2, and then continue this way:
To space multiple controls vertically or horizontally, follow Steps 1 and 2 and then continue:
The Design Time Grid Spacing depends on grid lines. The grid is made up of the array of dots you see on a form at design time. This grid is to help you place controls on a form, and by default, controls are aligned to the grid (which means they are sized to fit along vertical and horizontal lines of dots). You can change the grid units (in twips) in the Options box when you click the General tab, as shown in Figure 2.13. (To open the Options box, select the Options item in the Tools menu.)
Besides setting the units of the grid, you can also specify whether or not controls must be aligned to the grid by checking the Align Controls To Grid checkbox. Setting A Startup Form Or ProcedureVisual Basic programs mean windows, right? Not necessarily. Visual Basic programs do not need to have any windows at all, in fact. That case is a little extreme, but there are times when you dont want to start your program with code in a form. For example, you might want to display a flash screen when your program first starts, without waiting for the first (possibly complex) form to load, and then switch to the form when it does load.
|
|
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. |