
392
LESSON 34 LocaLizing Programs
TRY IT
In this Try It, you write the program shown in Figures 34-5 and 34-6, which let you select fore-
ground and background colors in American English and Mexican Spanish.
FIGURE 345
FIGURE 346
You can download the code and resources for this Try It from the book’s web
page at
www.wrox.com or www.CSharpHelper.com/24hour.html. You can find
them in the Lesson34 folder of the download.
Lesson Requirements
Build the default interface.
Add code to handle the
RadioButtons’ Click events.
Localize the application for Mexican Spanish.
Add code to let you test the form for either locale.
Hints
There’s no need to build a separate event handler for each
RadioButton. Use one event handler
for all of the foreground buttons and one for all of the background buttons.
These event handlers must then figure out which button was clicked, but they cannot use the
buttons’ text because that will change depending on which locale is selected. They could use
the buttons’ names because they don’t change, but it’s even easier to store the corresponding
colors’ names in their
Tag properties and then use the Color class’s FromName method to get
the appropriate
Color.
Step-by-Step
Build the default interface.
1. Build a form that looks like the one shown in Figure 34-5.
596906c34.indd 392 4/7/10 12:34:47 PM