Starting Out With Visual C# (5th Edition)
Starting Out With Visual C# (5th Edition)
5th Edition
ISBN: 9780135183519
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 2, Problem 2PP
Program Plan Intro

Clickable Number Images

Program plan:

Design the form:

  • Place a five picture box control on the form, and change its name and properties to display the images.

In code window, write the code:

Program.cs:

  • Include the required libraries.
  • Define the namespace “NumberImage”.
    • Define a class “Program”.
      • Define a constructor for the class.
      • Define required functions to run “Form1”.

Form1.cs:

  • Include the required libraries.
  • Define namespace “NumberImage”.
    • Define a class “Form1”.
    • In pictureBox1_Click() method,
      • Display the number “one” in message box.
    • In pictureBox2_Click() method,
      • Display the number “two” in message box.
    • In pictureBox3_Click() method,
      • Display the number “three” in message box.
    • In pictureBox4_Click() method,
      • Display the number “four” in message box.
    • In pictureBox5_Click() method,
      • Display the number “five” in message box.
    • Close the application.

Form Design:

View the Form Design in IDE.

Starting Out With Visual C# (5th Edition), Chapter 2, Problem 2PP

Set the Form Control properties in Properties window as follows:

ObjectPropertySetting
Form1TextClickable Number Images
pictureBox1ImageSelect Resource
pictureBox2ImageSelect Resource
pictureBox3ImageSelect Resource
pictureBox4ImageSelect Resource
pictureBox5ImageSelect Resource
  • Add five picture box controls to the form from Toolbox.

Blurred answer
Students have asked these similar questions
Dice Simulator Create an application that simulates rolling a pair of dice. When the user clicks a button, the application should generate two random numbers, each in the range of 1 through 6, to represent the value of the dice. Use PictureBox controls to display the dice. (In the Student Sample Programs, in the Chap05 folder, you will find six images named Die1.bmp, Die2.bmp, Die3.bmp, Die4.bmp, Die5.bmp, and Die6.bmp that you can use in the PictureBoxes.)
True or False Forms and most controls have a Preferences property that allows you to change the object’s background color.
Button Toggle   How can we make a button that toggles a text view (not the button label) between "Howdy Class!" and "You Pressed Me!"? Please write the java onClick function that would be specified in the button onClick property. Do not use string comparison to determine the current state. Also, do not use hard code string values.

Chapter 2 Solutions

Starting Out With Visual C# (5th Edition)

Ch. 2.1 - Prob. 2.11CPCh. 2.1 - Prob. 2.12CPCh. 2.1 - What are the rules for naming controls?Ch. 2.1 - What naming convention do most C# programmers use...Ch. 2.3 - A file that contains program code is known as what...Ch. 2.3 - What must you do if you want your application to...Ch. 2.3 - What does the Program.cs file contain?Ch. 2.3 - Prob. 2.18CPCh. 2.3 - Prob. 2.19CPCh. 2.3 - Prob. 2.20CPCh. 2.3 - Prob. 2.21CPCh. 2.3 - Prob. 2.22CPCh. 2.3 - Prob. 2.23CPCh. 2.3 - Prob. 2.24CPCh. 2.3 - What method do you use in Visual C# to display a...Ch. 2.3 - What is a literal?Ch. 2.3 - Prob. 2.27CPCh. 2.3 - Prob. 2.28CPCh. 2.5 - In which group of the Toolbox can you find the...Ch. 2.5 - Prob. 2.30CPCh. 2.5 - Prob. 2.31CPCh. 2.5 - Prob. 2.32CPCh. 2.5 - Prob. 2.33CPCh. 2.5 - Prob. 2.34CPCh. 2.5 - Prob. 2.35CPCh. 2.5 - How can you use a Label control to display output...Ch. 2.5 - What happens if you assign an empty string to a...Ch. 2.7 - What is a PictureBox control used for?Ch. 2.7 - Prob. 2.39CPCh. 2.7 - Prob. 2.40CPCh. 2.7 - Prob. 2.41CPCh. 2.7 - Prob. 2.42CPCh. 2.7 - Prob. 2.43CPCh. 2.7 - Prob. 2.44CPCh. 2.8 - Prob. 2.45CPCh. 2.8 - Prob. 2.46CPCh. 2.8 - Prob. 2.47CPCh. 2.8 - Why do programmers insert blank lines and...Ch. 2.10 - What statement do you use to close an applications...Ch. 2.10 - Prob. 2.50CPCh. 2.10 - Prob. 2.51CPCh. 2.10 - Prob. 2.52CPCh. 2 - Prob. 1MCCh. 2 - Prob. 2MCCh. 2 - __________ is the name of the blank form that...Ch. 2 - Prob. 4MCCh. 2 - A file that contains program code is called a(n)...Ch. 2 - A namespace is container that holds __________. a....Ch. 2 - A(n) __________ is a method that executes when a...Ch. 2 - Prob. 8MCCh. 2 - Prob. 9MCCh. 2 - Prob. 10MCCh. 2 - Prob. 11MCCh. 2 - The time during which you build the GUI and write...Ch. 2 - The time during which an application is executing...Ch. 2 - When you want to display text on a form, you use a...Ch. 2 - The __________ property allows you to set the...Ch. 2 - A __________ property can be set to one of two...Ch. 2 - Prob. 17MCCh. 2 - Prob. 18MCCh. 2 - In code, you use a(n) __________ to store a value...Ch. 2 - Prob. 20MCCh. 2 - The standard notation for referring to a controls...Ch. 2 - __________ is a feature of Visual Studio that...Ch. 2 - Prob. 23MCCh. 2 - Prob. 24MCCh. 2 - Prob. 25MCCh. 2 - Prob. 26MCCh. 2 - Most controls have a __________ property that...Ch. 2 - A(an) __________ appears on one line in a program....Ch. 2 - A __________ can occupy multiple consecutive lines...Ch. 2 - Programmers commonly use blank lines and...Ch. 2 - To close an applications form in code, you use the...Ch. 2 - Changing an objects Text property also changes the...Ch. 2 - When a form is created, its Text property is...Ch. 2 - The forms title is displayed in the bar along the...Ch. 2 - Prob. 4TFCh. 2 - Prob. 5TFCh. 2 - Prob. 6TFCh. 2 - In C# code, each opening brace must have a...Ch. 2 - When you double-click a control in the Designer,...Ch. 2 - Prob. 9TFCh. 2 - Prob. 10TFCh. 2 - Prob. 11TFCh. 2 - Prob. 12TFCh. 2 - Prob. 13TFCh. 2 - Prob. 14TFCh. 2 - Prob. 15TFCh. 2 - Prob. 16TFCh. 2 - When you write the values true or false in code,...Ch. 2 - Prob. 18TFCh. 2 - To close an applications form in code, you use the...Ch. 2 - The Visual Studio code editor examines each...Ch. 2 - What does a bounding box indicate about an object...Ch. 2 - Prob. 2SACh. 2 - What determines an objects appearance and other...Ch. 2 - Prob. 4SACh. 2 - Prob. 5SACh. 2 - What steps must you perform to change a forms Size...Ch. 2 - Prob. 7SACh. 2 - Prob. 8SACh. 2 - Prob. 9SACh. 2 - Prob. 10SACh. 2 - Prob. 11SACh. 2 - Prob. 12SACh. 2 - Prob. 13SACh. 2 - Prob. 14SACh. 2 - Prob. 15SACh. 2 - Prob. 16SACh. 2 - Prob. 17SACh. 2 - Prob. 18SACh. 2 - What are the three types of comments you can use...Ch. 2 - How does Visual Studio help you to quickly correct...Ch. 2 - Prob. 1AWCh. 2 - Prob. 2AWCh. 2 - Prob. 3AWCh. 2 - Suppose an applications GUI has a Label control...Ch. 2 - Suppose an applications GUI has a PictureBox...Ch. 2 - Latin Translator Look at the following list of...Ch. 2 - Prob. 2PPCh. 2 - Prob. 3PPCh. 2 - Joke and Punch Line A joke typically has two...Ch. 2 - Prob. 5PPCh. 2 - Prob. 6PP
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage