12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

236 Day 7<br />

The Align Tops, Align Bottoms, and Align Right Edges options work just like the Align Left<br />

Edges option we used earlier. There’s not much po<strong>in</strong>t <strong>in</strong> go<strong>in</strong>g over all the possibilities that<br />

exist for their use.<br />

TIP<br />

The first component selected will be the anchor po<strong>in</strong>t when you’re<br />

us<strong>in</strong>g any of the edge-alignment options. Refer to Figure 7.4. Let’s say<br />

you had selected Button3 first and then used Shift+click to select the<br />

rema<strong>in</strong><strong>in</strong>g buttons. When you chose Align Left Edges, Button3 would<br />

rema<strong>in</strong> where it is and all other buttons would be l<strong>in</strong>ed up with<br />

Button3’s left edge because Button3 is the anchor component.<br />

The Align Horizontally Across Centers and Align Vertically Across Centers options can be<br />

used to center components relative to one another. This is best illustrated with shapes. Start<br />

with a new form (or delete the buttons from the form you have been work<strong>in</strong>g on). Now do<br />

the follow<strong>in</strong>g:<br />

1. Click on the Additional tab on the Component Palette and choose the Shape<br />

component. Click somewhere on the upper left of the form to add the shape.<br />

2. Change the Shape property to stCircle.<br />

3. Change the Width property to 150.<br />

4. Double-click the Brush property and change the Color property of the Brush<br />

property to clBlack.<br />

5. Place another Shape component on the form.<br />

6. Change the second shape’s Shape property to stCircle as well. Now you have two<br />

circles of different sizes on the screen—a white circle and a black circle.<br />

7. Click on the black circle. Hold the Shift key and click on the white circle. Both<br />

shapes are selected.<br />

8. Choose View | Alignment Palette from the ma<strong>in</strong> menu, if necessary (it may already<br />

be displayed). Arrange the Alignment Palette so you can see the two shapes on the<br />

form. Observe the shapes as you perform the follow<strong>in</strong>g two steps.<br />

9. Click the Align Vertically Across Centers button on the Alignment Palette. The<br />

vertical centers are aligned.<br />

10. Click the Align Horizontally Across Centers button on the Alignment Palette. The<br />

horizontal centers are aligned. Congratulations—you made a tire!<br />

Did you see the impact as you performed the last two steps? Notice that because you selected<br />

the black circle first, it did not move (it is the anchor component), but the white circle moved<br />

as you clicked the alignment buttons. You can use these alignment options to center any

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!