Answers To Self-Review Exercises

Table of contents:


a) True. b) True. c) True. d) True. e) False. RadioButtons are used to represent a set of mutually exclusive options. f) False. A Label's text cannot be edited by the user. g) True. h) False. Some mouse events use EventArgs, others use MouseEventArgs. i) True. j) True. k) False. A control's tool tip text is set using a ToolTip component that must be added to the application.


a) focus. b) container. c) event. d) signature. e) password. f) GroupBox, Panel. g) mouse clicks, mouse presses, mouse moves. h) Key. i) Shift, Ctrl, Alt. j) multicast.



Extend the program in Fig. 13.26 to include a CheckBox for every font-style option. [Hint: Use logical exclusive OR (^) rather than testing for every bit explicitly.]


Create the GUI in Fig. 13.41 (you do not have to provide functionality).

Figure 13.41. Calculator GUI.


Create the GUI in Fig. 13.42 (you do not have to provide functionality).

Figure 13.42. Printer GUI.


Write a temperature conversion program that converts from Fahrenheit to Celsius. The Fahrenheit temperature should be entered from the keyboard (via a TextBox). A Label should be used to display the converted temperature. Use the following formula for the conversion:

Celsius = ( 5 / 9 ) x ( Fahrenheit 32 )


Extend the program of Fig. 13.38 to include options for changing the size and color of the lines drawn. Create a GUI similar to Fig. 13.43. The user should be able to draw on the application's Panel. To retrieve a Graphics object for drawing, call method panelName.CreateGraphics(), substituting in the name of your Panel.

Figure 13.43. Drawing Panel GUI.


Write a program that plays "guess the number" as follows: Your program chooses the number to be guessed by selecting an int at random in the range 11000. The program then displays the following text in a label:

 I have a number between 1 and 1000--can you guess my number?
 Please enter your first guess.

A TextBox should be used to input the guess. As each guess is input, the background color should change to red or blue. Red indicates that the user is getting "warmer," blue that the user is getting "colder." A Label should display either "Too High" or "Too Low," to help the user zero in on the correct answer. When the user guesses the correct answer, display "Correct!" in a message box, change the Form's background color to green and disable the TextBox. Recall that a TextBox (like other controls) can be disabled by setting the control's Enabled property to false. Provide a Button that allows the user to play the game again. When the Button is clicked, generate a new random number, change the background to the default color and enable the TextBox.


Write an application that allows users to process orders for fuzzy dice. The application should calculate the total price of the order, including tax and shipping. TextBoxes for inputting the order number, the customer name and the shipping address are provided. Initially, these fields contain text that describes their purpose. Provide CheckBoxes for selecting the fuzzy-dice color and TextBoxes for inputting the quantities of fuzzy dice to order. The application should update the total cost, tax and shipping when the user changes any one of the three Quantity fields' values. The application should also contain a Button that when clicked, returns all fields to their original values. Use 5% for the tax rate. Shipping charges are $1.50 for up to 20 pairs of dice. If more than 20 pairs of dice are ordered, shipping is free. All fields must be filled out at the top, and an item must be checked for the user to enter a quantity for that item.



    Introduction to Computers, the Internet and Visual C#

    Introduction to the Visual C# 2005 Express Edition IDE

    Introduction to C# Applications

    Introduction to Classes and Objects

    Control Statements: Part 1

    Control Statements: Part 2

    Methods: A Deeper Look


    Classes and Objects: A Deeper Look

    Object-Oriented Programming: Inheritance

    Polymorphism, Interfaces & Operator Overloading

    Exception Handling

    Graphical User Interface Concepts: Part 1

    Graphical User Interface Concepts: Part 2


    Strings, Characters and Regular Expressions

    Graphics and Multimedia

    Files and Streams

    Extensible Markup Language (XML)

    Database, SQL and ADO.NET

    ASP.NET 2.0, Web Forms and Web Controls

    Web Services

    Networking: Streams-Based Sockets and Datagrams

    Searching and Sorting

    Data Structures



    Appendix A. Operator Precedence Chart

    Appendix B. Number Systems

    Appendix C. Using the Visual Studio 2005 Debugger

    Appendix D. ASCII Character Set

    Appendix E. Unicode®

    Appendix F. Introduction to XHTML: Part 1

    Appendix G. Introduction to XHTML: Part 2

    Appendix H. HTML/XHTML Special Characters

    Appendix I. HTML/XHTML Colors

    Appendix J. ATM Case Study Code

    Appendix K. UML 2: Additional Diagram Types

    Appendix L. Simple Types


    Visual C# How to Program
    Visual C# 2005 How to Program (2nd Edition)
    ISBN: 0131525239
    EAN: 2147483647
    Year: 2004
    Pages: 600

    Similar book on Amazon

    Flylib.com © 2008-2020.
    If you may any questions please contact us: flylib@qtcs.net