public GetControlToolTip ( string controlName ) : ToolTip, | ||
controlName | string | |
return | ToolTip, |
private void radioButtonCalifornia_CheckedChanged(object sender, EventArgs e) { /*Makes visible the information for the radioButtonCalifornia information visible. * Sets the background color, loads the image into the picture box. * Sets the tooltip defined in the ToolTipHelper class to the desired value. * Sets the label information */ statePictureBox.Visible = true; stateInformationGroupBox.Visible = true; stateInformationGroupBox.BackColor = Color.Orange; //Try for image load try { //If the operation is normal,this line of code will execute this.statePictureBox.Image = Image.FromFile("California.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(statePictureBox, "A view of a Californian pier"); mainStateLabel.Text = "State of California"; populationInformationLabel.Text = "The State of California has about 40 million people"; climateInformationLabel.Text = "California's climate is varied."; nickNameInformationLabel.Text = "The Golden State"; }
private void radioButtonWashington_CheckedChanged(object sender, EventArgs e) { /*Makes visible the information for the radioButtonWashington information visible. * Sets the background color, loads the image into the picture box. * Sets the tooltip defined in the ToolTipHelper class to the desired value. * Sets the label information */ statePictureBox.Visible = true; stateInformationGroupBox.Visible = true; stateInformationGroupBox.BackColor = Color.MediumPurple; //Try for image load try { //If the operation is normal,this line of code will execute this.statePictureBox.Image = Image.FromFile("Washington.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(statePictureBox, "A view of Seattle"); mainStateLabel.Text = "State of Washington"; populationInformationLabel.Text = "The State of Washington has about 7 million people"; climateInformationLabel.Text = "Washington's climate is mild, with a moderate" + Environment.NewLine + "amount of rain"; nickNameInformationLabel.Text = "The Evergreen State"; }
private void addToShoppingCartButton_Click(object sender, EventArgs e) { //handles duplicate and no text entered. Adds pizza types to list box of price and pizza. if (selectedPizzaListBox.Items.Contains(orderPizzaTextBox.Text.ToUpper())) { MessageBox.Show("Duplicates not allowed"); } else if (orderPizzaTextBox.Text == "CHEESE PIZZA") { passwordLoginErrorProvider.SetError(orderPizzaTextBox, null); selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper()); priceListBox.Items.Add(13.99); try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("cheese.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Cheese Pizza"); typeOfPizzaLabel.Text = "Cheese Pizza $13.99"; } else if (orderPizzaTextBox.Text == "PEPPERONI PIZZA") { passwordLoginErrorProvider.SetError(orderPizzaTextBox, null); selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper()); priceListBox.Items.Add(12.99); try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("pepperoni.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Pepperoni Pizza"); typeOfPizzaLabel.Text = "Pepperoni Pizza $12.99"; } else if (orderPizzaTextBox.Text == "CALZONE PIZZA") { passwordLoginErrorProvider.SetError(orderPizzaTextBox, null); selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper()); priceListBox.Items.Add(14.99); try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("calzone.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Calzone Pizza"); typeOfPizzaLabel.Text = "Calzone Pizza $14.99"; } else if (orderPizzaTextBox.Text == "ITALIAN PIZZA") { passwordLoginErrorProvider.SetError(orderPizzaTextBox, null); selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper()); priceListBox.Items.Add(15.99); //Try for image load try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("italian.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Italian Pizza"); typeOfPizzaLabel.Text = "Italian Pizza $15.99"; } else { MessageBox.Show("Please enter valid Pizza name"); } orderPizzaTextBox.ResetText(); }
private void loadSectionComboBox_SelectedIndexChanged(object sender, EventArgs e) { //Switch case to set stateTextBox text and load the associated image and tooltip switch (loadSectionComboBox.SelectedItem) { case "OR": { stateTextBox.Text = "State of Oregon"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("oregon.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of Oregon"); } break; case "WA": { stateTextBox.Text = "State of Washington"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("washington.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of Washington"); } break; case "CA": { stateTextBox.Text = "State of California"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("california.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of California"); } break; case "NY": { stateTextBox.Text = "State of New York"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("newyork.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of New York"); } break; case "ID": { stateTextBox.Text = "State of Idaho"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("idaho.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of Idaho"); } break; case "TX": { stateTextBox.Text = "State of Texas"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("texas.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of Texas"); } break; case "MI": { stateTextBox.Text = "State of Michigan"; stateImagePictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.stateImagePictureBox.Image = Image.FromFile("michigan.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this State did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(stateImagePictureBox, "Flag of Michigan"); } break; } }
private void specialsComboBox_SelectedIndexChanged(object sender, EventArgs e) { //If valid pizza is added, switch case will be selected and image and label will load. switch (specialsComboBox.SelectedItem) { case "PEPPERONI PIZZA": { pizzaPictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("pepperoni.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Pepperoni Pizza"); typeOfPizzaLabel.Text = "Pepperoni Pizza $12.99"; } break; case "CHEESE PIZZA": { pizzaPictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("cheese.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Cheese Pizza"); typeOfPizzaLabel.Text = "Cheese Pizza $13.99"; } break; case "CALZONE PIZZA": { pizzaPictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("calzone.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Calzone Pizza"); typeOfPizzaLabel.Text = "Calzone Pizza $14.99"; } break; case "ITALIAN PIZZA": { pizzaPictureBox.Visible = true; //Try for image load try { //If the operation is normal,this line of code will execute this.pizzaPictureBox.Image = Image.FromFile("italian.jpg"); } catch { // if the operation detects picture load failure, //the control will be passed to the catch statement MessageBox.Show ("The image for this pizza did not load." , "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information); } ToolTip tt = ToolTipHelper.GetControlToolTip(""); tt.SetToolTip(pizzaPictureBox, "Italian Pizza"); typeOfPizzaLabel.Text = "Italian Pizza $15.99"; } break; } }