P. 1
(eBook PDF) Learn Visual C++ 6

(eBook PDF) Learn Visual C++ 6

|Views: 30|Likes:
Published by silvershumi

More info:

Published by: silvershumi on Nov 01, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/24/2012

pdf

text

original

It is quite simple to incorporate a full-fledged Font dialog box into an application, but
the example in this section is going to do something much simpler. A group of radio
buttons will give the user a choice of several colors. One check box will enable the
user to specify that the text should be centered horizontally, and another that the
text be centered vertically. Because these are check boxes, the text can be either,
neither, or both.

Open the IDD_OPTIONS dialog box by double-clicking it in the ResourceView window,
and then add the radio buttons by following these steps:

1. Stretch the dialog box taller to make room for the new controls.

2. Click the radio button in the Controls floating toolbar, and then click the
Options dialog box to drop the control.

3. Choose View, Properties and then pin the Properties dialog box in place.

4. Change the resource ID of the first radio button to IDC_OPTIONS_BLACK, and
change the caption to &Black.

5. Select the Group box to indicate that this is the first of a group of radio
buttons.

6. Add another radio button with resource ID IDC_OPTIONS_RED and &Red as
the caption. Do not select the Group box because the Red radio button does not
start a new group but is part of the group that started with the Black radio
button.

7. Add a third radio button with resource ID IDC_OPTIONS_GREEN and &Green
as the caption. Again, do not select Group.

8. Drag the three radio buttons into a horizontal arrangement, and select all
three by clicking on one and then holding Ctrl while clicking the other two.

9. Choose Layout, Align Controls, Bottom (to even them up).

10. Choose Layout, Space Evenly, Across to space the controls across the dialog
box.

Next, add the check boxes by following these steps:

1. Click the check box in the Controls floating toolbar and then click the
Options dialog box, dropping a check box onto it.

2. Change the resource ID of this check box to IDC_OPTIONS_HORIZCENTER
and the caption to Center &Horizontally.

3. Select the Group box to indicate the start of a new group after the radio
buttons.

4. Drop another check box onto the dialog box as in step 1 and give it the resource
ID IDC_OPTIONS_VERTCENTER and the caption Center &Vertically.

5. Arrange the check boxes under the radio buttons.

6. Click the Group box on the Controls floating toolbar, and then click and drag
a group box around the radio buttons. Change the caption to Text Color.

7. Move the OK and Cancel buttons down to the bottom of the dialog box.

8. Select each horizontal group of controls and use Layout, Center in Dialog,

Horizontal to make things neater.

9. Choose Edit, Select All, and then drag all the controls up toward the top of
the dialog box. Shrink the dialog box to fit around the new controls. It should
now resemble Figure 8.15.

FIG. 8.15 The Options dialog box for ShowString has been expanded.

TIP: If you don't recognize the icons on the Controls toolbar, use the
ToolTips. If you hold the cursor over any of the toolbar buttons, a tip pops
up after a few seconds, telling you what control the button represents.

Finally, set the tab order by choosing Layout, Tab Order and then clicking the
controls, in this order:

1. IDC_OPTIONS_STRING

2. IDC_OPTIONS_BLACK

3. IDC_OPTIONS_RED

4. IDC_OPTIONS_GREEN

5. IDC_OPTIONS_HORIZCENTER

6. IDC_OPTIONS_VERTCENTER

7. IDOK

8. IDCANCEL

Then click away from the dialog box to leave the two static text controls as positions 9
and 10.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->