Разработать приложение, которое рассчитывает стоимость печати фотографий. Стоимость фото 9х12-8.50р, 12х15-10.00р, 18х24-20.00р.


Разработать приложение, которое рассчитывает стоимость печати фотографий. Стоимость фото 9х12-8.50р

Ульяна11111112 Ульяна11111112    1   27.06.2020 11:18    2

Ответы
Eгор43 Eгор43  15.10.2020 14:59

public partial class Form1 : Form

   {

       public Form1()

       {

           InitializeComponent();

       }

 

       private void Form1_Load(object sender, EventArgs e)

       {

           label3.Text = "Размер";

           label1.Text = "Количество";

           label2.Text = "";

           button1.Text = "Ok";

           radioButton1.Checked = true;

           button1.Enabled = false;

           radioButton1.Text = "9 x 12";

           radioButton2.Text = "12 x 15";

           radioButton3.Text = "18 x 24";

       }

 

       private void button1_Click(object sender, EventArgs e)

       {

           double cena = 8.50;

           int n;

           double cuma;

           if (radioButton1.Checked)

               cena = 8.50;

           if (radioButton2.Checked)

               cena = 10.50;

           if (radioButton3.Checked)

               cena = 12.50;

           n = Convert.ToInt32(textBox1.Text);

           cuma = cena * n;

           label2.Text = cuma.ToString("C");

       }

 

       private void textBox1_KeyPress(object sender, KeyPressEventArgs e)

       {

           if((e.KeyChar>='0')&&(e.KeyChar<='9'))

           {

               return;

           }

           if(char.IsControl (e.KeyChar))

           {

               if(e.KeyChar==(char) Keys.Enter)

               {

                   button1.Focus();

               }

               return;

 

           }

           e.Handled = true;

       }

 

       private void textBox1_TextChanged(object sender, EventArgs e)

       {

           if (textBox1.Text.Length == 0)

           {

               button1.Enabled = false;

           }

           else

           {

               button1.Enabled = true;

           }

           label2.Text = "";

       }

 

       private void radioButton1_Click(object sender, EventArgs e)

       {

           label2.Text = "";

           textBox1.Focus();

       }

 

       private void radioButton2_Click(object sender, EventArgs e)

       {

           label2.Text = "";

           textBox1.Focus();

       }

 

       private void radioButton3_Click(object sender, EventArgs e)

       {

           label2.Text = "";

           textBox1.Focus();

       }

   }

Объяснение:

Если на С#, то вот

ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика