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.

300 Day 8<br />

The Glyph Property<br />

The Glyph property represents the bitmap on the button. The value of the Glyph property is<br />

a picture, or glyph.<br />

NEW TERM<br />

A glyph is a picture that is typically <strong>in</strong> the form of a W<strong>in</strong>dows bitmap file (BMP).<br />

The glyph itself consists of one or more bitmaps that represent the four possible states a<br />

button can be <strong>in</strong>: up, down, disabled, and stay down. If you are creat<strong>in</strong>g your own buttons,<br />

you can probably get by with supply<strong>in</strong>g just one glyph, which the BitBtn component will then<br />

modify to represent the other three possible states. The bitmap will move down and to the<br />

left when the button is clicked and will be grayed out when disabled. The glyph <strong>in</strong> the staydown<br />

state will be the same as <strong>in</strong> the up state, although the button face will change to give<br />

a pressed look.<br />

If you provide more than one glyph, the glyphs must all be the same height and width and<br />

must be conta<strong>in</strong>ed <strong>in</strong> a bitmap strip. The bitmaps that ship with <strong>C++</strong>Builder provide two<br />

glyphs. Figure 8.5 shows the bitmap for the pr<strong>in</strong>t button that comes with <strong>C++</strong>Builder<br />

(PRINT.BMP) <strong>in</strong> both its actual size and zoomed <strong>in</strong> to show detail. Note that the two glyphs<br />

each occupy the same width <strong>in</strong> the bitmap.<br />

Figure 8.5.<br />

The PRINT.BMP<br />

bitmap.<br />

TIP<br />

The pixel <strong>in</strong> the lower-left corner of the bitmap is the color that will be<br />

used for the transparent color. Any pixels <strong>in</strong> the bitmap hav<strong>in</strong>g that<br />

color will be transparent when the glyph is displayed on the button.<br />

You must keep this <strong>in</strong> m<strong>in</strong>d when design<strong>in</strong>g your bitmaps. If you are<br />

not us<strong>in</strong>g transparency, you will need the pixel <strong>in</strong> the lower-left corner<br />

to be a color not present anywhere else on the bitmap.

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

Saved successfully!

Ooh no, something went wrong!