Answer the question
In order to leave comments, you need to log in
How to hide an Image in a PictureBox when switching to another case?
During the development of the testing system, I encountered a problem that when switching to another case (I used the switch / case construction), the picture is not hidden or remains unchanged. How to fix this problem? What construction should be written so that when moving to the next case, the PictureBox is hidden? (I may have somehow formulated the question incorrectly, I am only writing the second topic here, and I don’t understand it very well, please don’t be angry with me :) )
Answer the question
In order to leave comments, you need to log in
Got it! It's cumbersome, but it works
//Вопрос 1
case 0:
pictureBox1.Image = new Bitmap(ProgrammaDlyaKursovoyZudikhinLeonidP27c.Properties.Resources.t1);
label2.Text = "В электронной таблице Excel отражены данные о деятельности страховой компании за 4 месяца. Страховая компания осуществляет страхование жизни, недвижимости, автомобилей и финансовых рисков своих клиентов. Суммы полученных по каждому виду деятельности за эти месяцы страховых взносов(в тысячах рублей) также вычислены в таблице. Известно, что за эти 4 месяца компании пришлось выплатить двум клиентам по 20 000 рублей каждому. Какова прибыль страховой компании в рублях за прошедшие 4 месяца ?";
radioButton1.Text = "60 000";
radioButton2.Text = "20 000";
radioButton3.Text = "80 000";
radioButton4.Text = "70 000";
pictureBox1.Visible = true;
pictureBox2.Visible = false;
break;
//Вопрос 2
case 1:
label2.Text = " ";
radioButton1.Text = " ";
radioButton2.Text = " ";
radioButton3.Text = " ";
radioButton4.Text = " ";
pictureBox1.Visible = false;
pictureBox2.Visible = false;
break;
//Вопрос 3
case 2:
label2.Text = " ";
radioButton1.Text = " ";
radioButton2.Text = " ";
radioButton3.Text = " ";
radioButton4.Text = " ";
pictureBox1.Visible = false;
pictureBox2.Visible = false;
break;
//Вопрос 4
case 3:
label2.Text = " ";
radioButton1.Text = " ";
radioButton2.Text = " ";
radioButton3.Text = " ";
radioButton4.Text = " ";
pictureBox1.Visible = false;
pictureBox2.Visible = false;
break;
//Вопрос 5
case 4:
pictureBox1.Image = new Bitmap(ProgrammaDlyaKursovoyZudikhinLeonidP27c.Properties.Resources.t4);
label2.Text = " ";
radioButton1.Text = " ";
radioButton2.Text = " ";
radioButton3.Text = " ";
radioButton4.Text = " ";
pictureBox1.Visible = true;
pictureBox2.Visible = false;
break;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question