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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

238 Day 7<br />

The Align Property<br />

The Align property controls how a component is aligned with its parent. The possible values<br />

for the Align property and a description of each are listed <strong>in</strong> Table 7.3.<br />

Table 7.3. Possible values for the Align property.<br />

Value Description<br />

alBottom The component will be aligned at the bottom of the parent w<strong>in</strong>dow.<br />

A status bar is an example of a component aligned along the bottom<br />

of a ma<strong>in</strong> form.<br />

alClient The component will expand to fill the client area of the parent<br />

w<strong>in</strong>dow. If other components occupy part of the client area, the<br />

component will fill what client area rema<strong>in</strong>s. Examples <strong>in</strong>clude Memo<br />

components, Image components, and RichEdit components.<br />

alLeft The component will be aligned along the left edge of the parent<br />

w<strong>in</strong>dow. A horizontal speedbar is an example of a left-aligned<br />

component.<br />

alNone The component will be placed as designed with no special<br />

relationship to the parent. This is the default for most components.<br />

alRight The component will be aligned along the right edge of the parent.<br />

alTop The component will be aligned along the top of the parent’s<br />

w<strong>in</strong>dow. A speedbar is an example of this type of alignment.<br />

An illustration will help expla<strong>in</strong> alignment. Start with a blank form. Then perform these steps:<br />

1. Click on the Standard tab on the Component Palette and choose a Panel component.<br />

Place the panel anywhere on the form.<br />

2. Locate the Align property <strong>in</strong> the Object Inspector (it’s at the top of the list). Notice<br />

that it is set on alNone. Change the Align property to alTop. The panel is aligned at<br />

the top of the form, and it expands to fill the width of the form.<br />

3. Try to move the panel back to the middle of the form. The panel will snap back to<br />

the top of the form.<br />

4. Try to make the panel narrower. Notice that the panel reta<strong>in</strong>s its width.<br />

5. Change the panel’s height. Note that the panel’s height can be changed (while the<br />

width cannot).<br />

6. Change the Align to alBottom. Now the panel is glued to the bottom of the form.<br />

7. Change the Align to alRight and then alLeft. Notice how the panel keeps its<br />

orig<strong>in</strong>al shape. The width is now the same as the height was before. In effect, the<br />

panel is rotated. Aga<strong>in</strong>, attempts to vertically move or size the panel fail.

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

Saved successfully!

Ooh no, something went wrong!