Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using visual studio Orion is one of the most famous constellations in the night

ID: 668042 • Letter: U

Question

Using visual studio

Orion is one of the most famous constellations in the night sky. In the Chap02 folder

of the Student Sample Programs that accompany this book, you will find an image

file named Orion.bmp, which contains a diagram of the Orion constellation. Create

an application that displays the Orion image in a PictureBox control, as shown on

the left in Figure 2-82 . The application should have a button that, when clicked,

displays the names of each of the stars, as shown on the right in Figure 2-82 . The

application should have another button that, when clicked, hides the star names.

The names of the stars are Betelgeuse , Meissa , Alnitak , Alnilam , Mintaka , Saiph ,

and Rigel .

Hint: Place the PictureBox control with the Orion image on the form. Then, place

Label controls containing the star names on top of the PictureBox. Use the Properties

window to set each of the Label control’s Visible property to False. That

will cause the labels to be invisible when the application runs. The Show Star

Names button will set each of the Label control’s Visible property to true , and

the Hide Star Names button will set each of the Label control’s Visible property

to false .

Explanation / Answer

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Problem_6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void showNamesButton_Click(object sender, EventArgs e) { betelgeuseLabel.Visible = true; meissaLabel.Visible = true; mintakaLabel.Visible = true; alnilamLabel.Visible = true; alnitakLabel.Visible = true; rigelLabel.Visible = true; saiphLabel.Visible = true; } private void hideNamesButton_Click(object sender, EventArgs e) { betelgeuseLabel.Visible = false; meissaLabel.Visible = false; mintakaLabel.Visible = false; alnilamLabel.Visible = false; alnitakLabel.Visible = false; rigelLabel.Visible = false; saiphLabel.Visible = false; } private void exitButton_Click(object sender, EventArgs e) { this.Close(); } } }