

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace lab1_b.b_e_
{
 public partial class Form1 : Form
 {
     float x;
     int a = 0;
     public Form1()
     {
         InitializeComponent();
     }
     private void bodogchtextBox_TextChanged_1(object sender, EventArgs e)
     {
         try
         {
             if (bodogchtextBox.TextLength == 0)
             {
                 a = 0;
             }
             else
             {
                 a = 1;
                 try
                 {
                     x = Convert.ToInt32(bodogchtextBox.Text);
                 }
                 catch (OverflowException)
                 {
                     MessageBox.Show("Hemjee ihdej bna");
                 }
                 if (this.tselsiiradioButton.Checked == true)
                 {
                     urdenlabel.Text = Convert.ToString((x - 32) * 5 / 9) + "°F";
                     bodogchtextBox.Text = x.ToString();
                 }
                 else
                 {
                     urdenlabel.Text = Convert.ToString(x * 9 / 5 + 32) + "C°";
                     bodogchtextBox.Text = x.ToString();
                 }
             }
         }
         catch (FormatException)
         {
          
             if (a == 1)
             {
                 bodogchtextBox.Text = x.ToString();
             }
             else
             {
                 bodogchtextBox.Text = "";
             }
         }
     }
     private void гарToolStripMenuItem_Click(object sender, EventArgs e)
     {
         Close();
     }
     private void helpclosebutton_Click(object sender, EventArgs e)
     {
         this.helppanel.Hide();
         this.label1.Show();
         this.urdenlabel.Show();
         this.bodogchtextBox.Show();
         this.groupBox1.Show();
      }
     private void aboutclosebutton_Click(object sender, EventArgs e)
     {
         this.aboutpanel.Hide();
         this.label1.Show();
         this.urdenlabel.Show();
         this.bodogchtextBox.Show();
         this.groupBox1.Show();
     }
     private void тусламжToolStripMenuItem1_Click(object sender, EventArgs e)
     {
         this.helppanel.Show();
         this.label1.Hide();
         this.urdenlabel.Hide();
         this.bodogchtextBox.Hide();
         this.groupBox1.Hide();
         this.aboutpanel.Hide();
     }
     private void тухайToolStripMenuItem_Click(object sender, EventArgs e)
     {
         this.helppanel.Hide();
         this.label1.Hide();
         this.urdenlabel.Hide();
         this.bodogchtextBox.Hide();
         this.groupBox1.Hide();
         this.aboutpanel.Show();
     }
     private void Form1_Load(object sender, EventArgs e)
     {
         this.helppanel.Hide();
         this.aboutpanel.Hide();
     }
 }
}
 
No comments:
Post a Comment