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.

312 Day 8<br />

on your form. To accomplish this, create an <strong>in</strong>stance of the<br />

TOpenDialog class and then call its Execute() method:<br />

TOpenDialog openDlg = new TOpenDialog(this);<br />

if (openDlg->Execute()) {<br />

// do someth<strong>in</strong>g here<br />

}<br />

delete openDlg;<br />

If necessary, you can set any of the OpenDialog component’s properties<br />

before call<strong>in</strong>g Execute().<br />

The Color Dialog Box<br />

The Color dialog box allows the user to choose a color. When the OK button is clicked, the<br />

Color property will conta<strong>in</strong> the color <strong>in</strong>formation. (Refer to Figure 8.1, which shows the<br />

Color dialog box.) The Color dialog box, like the file dialog boxes, has no events to respond to.<br />

The Font Dialog Box<br />

The Font dialog box allows the user to choose a font from the list of fonts available on his<br />

or her system. Through the Device property, you can choose whether you want screen fonts,<br />

pr<strong>in</strong>ter fonts, or both types of fonts to be displayed. You can limit the maximum and<br />

m<strong>in</strong>imum font sizes that the user can select by modify<strong>in</strong>g the MaxFontSize and M<strong>in</strong>FontSize<br />

properties. As with the File dialog boxes, the Options property conta<strong>in</strong>s a wide variety of<br />

options you can use to control how the Font dialog box functions.<br />

If the user clicks OK, the Font property will conta<strong>in</strong> all the <strong>in</strong>formation you need to<br />

implement the new font. Figure 8.10 shows the Font dialog box <strong>in</strong> the default configuration.<br />

Figure 8.10.<br />

The Font dialog box.

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

Saved successfully!

Ooh no, something went wrong!