Making-a-Difference Exercises

  1. 14.10 (Ecofont) Ecofont—developed by SPRANQ (a Netherlands-based company)—is a font designed to reduce by as much as 20% the amount of ink used for printing, thus reducing also the number of ink cartridges used and the environmental impact of the manufacturing and shipping processes (using less energy, less fuel for shipping, and so on). The font, based on sans-serif Verdana, has small circular “holes” in the letters that are not visible in smaller sizes—such as the 9- or 10-point type frequently used. Download the free version of Ecofont

    
    http://www.ecofont.com/en/products/green/font/download-the-ink-saving-font.html
    

    then install the font file ecofont_vera_sans_regular.ttf using the instructions from the Ecofont website. Next, develop a GUI-based program that allows you to type text in a TextBox to be displayed in the Ecofont. Create Increase Font Size and Decrease Font Size buttons that allow you to scale up or down by one point at a time. Set the TextBox’s Font property to 9 point Ecofont. Set the TextBox’s MultiLine property to true so the user can enter multiple lines of text. As you scale up the font, you’ll be able to see the holes in the letters more clearly. As you scale down, the holes will be less apparent. To change the TextBox’s font programmatically, use a statement of the form:

    
    inputTextBox.Font = new Font(inputTextBox.Font.FontFamily,
       inputTextBox.Font.SizeInPoints + 1);
    

    This changes the TextBox’s Font property to a new Font object that uses the TextBox’s current font, but adds 1 to its SizeInPoints property to increase the font size. A similar statement can be used to decrease the font size. What is the smallest font size at which you begin to notice the holes?

  2. 14.11 (Project: Typing Tutor—Tuning a Crucial Skill in the Computer Age) Typing quickly and correctly is an essential skill for working effectively with computers and the Internet. In this exercise, you’ll build an app that can help users learn to “touch type” (i.e., type correctly without looking at the keyboard). The app should display a virtual keyboard that mimics the one on your computer and should allow the user to watch what he or she is typing on the screen without looking at the actual keyboard. Use Buttons to represent the keys. As the user presses each key, the app highlights the corresponding Button and adds the character to a TextBox that shows what the user has typed so far. [Hint: To highlight a Button, use its BackColor property to change its background color. When the key is released, reset its original background color.]

    You can test your program by typing a pangram—a phrase that contains every letter of the alphabet at least once—such as “The quick brown fox jumped over a lazy dog.” You can find other pangrams on the web.

    To make the program more interesting you could monitor the user’s accuracy. You could have the user type specific phrases that you’ve prestored in your program and that you display on the screen above the virtual keyboard. You could keep track of how many keystrokes the user types correctly and how many are typed incorrectly. You could also keep track of which keys the user is having difficulty with and display a report showing those keys.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset