Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 21.10 KB | None | 0 0
  1. //Form1.cs
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace WindowsFormsApp2
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public static int language = -1;
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void Form1_Load(object sender, EventArgs e)
  23.         {
  24.             if (language == 0)
  25.             {
  26.                 label2.Text = "嗨。";
  27.                 label2.Location = new Point(291, 40);
  28.                 label3.Text = "进入线以下的数字,其根你想要的计算。";
  29.                 label3.Location = new Point(176, 74);
  30.                 label4.Text = "指定所需的精确度(<15个字符):";
  31.                 label4.Location = new Point(170, 148);
  32.                 textBox3.Location = new Point(376, 148);
  33.                 button1.Text = "计算";
  34.                 label1.Text = "你的回答:";
  35.                 label1.Location = new Point(176, 254);
  36.                 button2.Text = "输出";
  37.                 главнаяToolStripMenuItem.Text = "主";
  38.                 настройкиToolStripMenuItem.Text = "设置";
  39.                 сменитьЯзыкToolStripMenuItem.Text = "要改变语言:";
  40.                 выходToolStripMenuItem.Text = "输出";
  41.                 справкаToolStripMenuItem.Text = "帮助";
  42.                 оПрограммеToolStripMenuItem.Text = "有关程序";
  43.                 button3.Text = "对清楚的领域";
  44.             }
  45.             if (language == 1)
  46.             {
  47.                 label2.Text = "Hello.";
  48.                 label2.Location = new Point(277, 40);
  49.                 label3.Text = "Enter in the line below the number whose root you want to calculate.";
  50.                 label3.Location = new Point(78, 74);
  51.                 label4.Text = "Specify the required precision(<15 characters):";
  52.                 label4.Location = new Point(110, 148);
  53.                 textBox3.Location = new Point(421, 148);
  54.                 button1.Text = "Calculate";
  55.                 label1.Text = "Your answer: ";
  56.                 label1.Location = new Point(161, 254);
  57.                 button2.Text = "Exit";
  58.                 главнаяToolStripMenuItem.Text = "Main";
  59.                 настройкиToolStripMenuItem.Text = "Settings";
  60.                 сменитьЯзыкToolStripMenuItem.Text = "Change Language:";
  61.                 выходToolStripMenuItem.Text = "Exit";
  62.                 справкаToolStripMenuItem.Text = "Help";
  63.                 оПрограммеToolStripMenuItem.Text = "About the program";
  64.                 button3.Text = "Clear the fields";
  65.             }
  66.             if (language == 2)
  67.             {
  68.                 label2.Text = "Saludos.";
  69.                 label2.Location = new Point(271, 40);
  70.                 label3.Text = "Escriba en la línea por debajo de un número, la raíz de la cual se debe calcular.";
  71.                 label3.Location = new Point(37, 74);
  72.                 label4.Text = "Especifique la precisión necesaria(<15 caracteres):";
  73.                 label4.Location = new Point(93, 148);
  74.                 textBox3.Location = new Point(439, 148);
  75.                 button1.Text = "Calcular";
  76.                 label1.Text = "Su respuesta: ";
  77.                 label1.Location = new Point(182, 254);
  78.                 button2.Text = "La salida";
  79.                 главнаяToolStripMenuItem.Text = "La principal";
  80.                 настройкиToolStripMenuItem.Text = "Ajustes";
  81.                 сменитьЯзыкToolStripMenuItem.Text = "Cambiar el idioma:";
  82.                 выходToolStripMenuItem.Text = "La salida";
  83.                 справкаToolStripMenuItem.Text = "Ayuda";
  84.                 оПрограммеToolStripMenuItem.Text = "Sobre el programa de";
  85.                 button3.Text = "Borrar campos";
  86.             }
  87.             if (language == 3)
  88.             {
  89.                 label2.Text = "Olá.";
  90.                 label2.Location = new Point(285, 40);
  91.                 label3.Text = "Escreva na linha abaixo do número, cuja raiz é a necessidade de calcular.";
  92.                 label3.Location = new Point(59, 74);
  93.                 label4.Text = "Especifique a precisão(<15 caracteres):";
  94.                 label4.Location = new Point(133, 148);
  95.                 textBox3.Location = new Point(399, 148);
  96.                 button1.Text = "Calcular";
  97.                 label1.Text = "Sua resposta: ";
  98.                 label1.Location = new Point(182, 254);
  99.                 button2.Text = "Saída";
  100.                 главнаяToolStripMenuItem.Text = "Página principal";
  101.                 настройкиToolStripMenuItem.Text = "Configuração";
  102.                 сменитьЯзыкToolStripMenuItem.Text = "Alterar o idioma:";
  103.                 выходToolStripMenuItem.Text = "Saída";
  104.                 справкаToolStripMenuItem.Text = "Referência";
  105.                 оПрограммеToolStripMenuItem.Text = "Sobre o programa";
  106.                 button3.Text = "Limpar os campos de";
  107.             }
  108.             if (language == 4)
  109.             {
  110.                 label2.Text = "Привет.";
  111.                 label2.Location = new Point(268, 40);
  112.                 label3.Text = "Введите в строку ниже число, корень которого необходимо вычислить.";
  113.                 label3.Location = new Point(58, 74);
  114.                 label4.Text = "Укажите необходимую точность(<15 знаков):";
  115.                 label4.Location = new Point(109, 148);
  116.                 textBox3.Location = new Point(422, 148);
  117.                 button1.Text = "Вычислить";
  118.                 label1.Text = "Ваш ответ: ";
  119.                 label1.Location = new Point(171, 254);
  120.                 button2.Text = "Выход";
  121.                 главнаяToolStripMenuItem.Text = "Главная";
  122.                 настройкиToolStripMenuItem.Text = "Настройки";
  123.                 сменитьЯзыкToolStripMenuItem.Text = "Сменить язык:";
  124.                 выходToolStripMenuItem.Text = "Выход";
  125.                 справкаToolStripMenuItem.Text = "Справка";
  126.                 оПрограммеToolStripMenuItem.Text = "О программе";
  127.                 button3.Text = "Очистить поля";
  128.             }
  129.         }
  130.  
  131.         private void button1_Click(object sender, EventArgs e)
  132.         {
  133.             double number;
  134.             int acc = -1;
  135.             bool flag = double.TryParse(textBox1.Text, out number);
  136.             bool flag1 = Int32.TryParse(textBox3.Text, out acc);
  137.             if (acc > 15){
  138.                 flag1 = false;
  139.             }
  140.             if (!flag && !flag1)
  141.             {
  142.                 if (language == 0)
  143.                 {
  144.                     MessageBox.Show("输入正确的数量中提取和准确的!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  145.                 }
  146.                 if (language == 1)
  147.                 {
  148.                     MessageBox.Show("Enter the correct number to extract and accuracy!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  149.                 }
  150.                 if (language == 2)
  151.                 {
  152.                     MessageBox.Show("Escriba correctas número para recuperar y precisión.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  153.                 }
  154.                 if (language == 3)
  155.                 {
  156.                     MessageBox.Show("Digite corretos número para extrair e precisão!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  157.                 }
  158.                 if (language == 4)
  159.                 {
  160.                     MessageBox.Show("Введите корректные число для извлечения и точность!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  161.                 }
  162.                 return;
  163.             }
  164.             if (!flag)
  165.             {
  166.                 if (language == 0)
  167.                 {
  168.                     MessageBox.Show("输入正确的数量提取的!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  169.                 }
  170.                 if (language == 1)
  171.                 {
  172.                     MessageBox.Show("Enter the correct number to extract!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  173.                 }
  174.                 if (language == 2)
  175.                 {
  176.                     MessageBox.Show("Introduzca el número correcto para su extracción!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  177.                 }
  178.                 if (language == 3)
  179.                 {
  180.                     MessageBox.Show("Digite um número válido para a extração!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  181.                 }
  182.                 if (language == 4)
  183.                 {
  184.                     MessageBox.Show("Введите корректное число для извлечения!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  185.                 }
  186.                 return;
  187.             }
  188.             if (!flag1)
  189.             {
  190.                 if (language == 0)
  191.                 {
  192.                     MessageBox.Show("输入正确的精确!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  193.                 }
  194.                 if (language == 1)
  195.                 {
  196.                     MessageBox.Show("Enter the correct accuracy!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  197.                 }
  198.                 if (language == 2)
  199.                 {
  200.                     MessageBox.Show("Escriba la correcta precisión.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  201.                 }
  202.                 if (language == 3)
  203.                 {
  204.                     MessageBox.Show("Digite garantir a precisão!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  205.                 }
  206.                 if (language == 4)
  207.                 {
  208.                     MessageBox.Show("Введите корректную точность!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  209.                 }
  210.                 return;
  211.             }
  212.             if (number < 0)
  213.             {
  214.                 textBox2.Text = Convert.ToString(Math.Round(Math.Sqrt(-number), acc)) + "i";
  215.             }
  216.             else if (number == 0)
  217.             {
  218.                 textBox2.Text = "0";
  219.             }
  220.             else
  221.             {
  222.                 textBox2.Text = Convert.ToString(Math.Round(Math.Sqrt(number), acc));
  223.             }
  224.         }
  225.  
  226.         private void выходToolStripMenuItem_Click(object sender, EventArgs e)
  227.         {
  228.             Application.Exit();
  229.         }
  230.  
  231.         private void button2_Click(object sender, EventArgs e)
  232.         {
  233.             Application.Exit();
  234.         }
  235.  
  236.         private void английскийToolStripMenuItem_Click(object sender, EventArgs e)
  237.         {
  238.             language = 1;
  239.             label2.Text = "Hello.";
  240.             label2.Location = new Point(277, 40);
  241.             label3.Text = "Enter in the line below the number whose root you want to calculate.";
  242.             label3.Location = new Point(78, 74);
  243.             label4.Text = "Specify the required precision(<15 characters):";
  244.             label4.Location = new Point(110, 148);
  245.             textBox3.Location = new Point(421, 148);
  246.             button1.Text = "Calculate";
  247.             label1.Text = "Your answer: ";
  248.             label1.Location = new Point(161, 254);
  249.             button2.Text = "Exit";
  250.             главнаяToolStripMenuItem.Text = "Main";
  251.             настройкиToolStripMenuItem.Text = "Settings";
  252.             сменитьЯзыкToolStripMenuItem.Text = "Change Language:";
  253.             выходToolStripMenuItem.Text = "Exit";
  254.             справкаToolStripMenuItem.Text = "Help";
  255.             оПрограммеToolStripMenuItem.Text = "About the program";
  256.             button3.Text = "Clear the fields";
  257.         }
  258.  
  259.         private void китайскийToolStripMenuItem_Click_1(object sender, EventArgs e)
  260.         {
  261.             language = 0;
  262.             label2.Text = "嗨。";
  263.             label2.Location = new Point(291, 40);
  264.             label3.Text = "进入线以下的数字,其根你想要的计算。";
  265.             label3.Location = new Point(176, 74);
  266.             label4.Text = "指定所需的精确度(<15个字符):";
  267.             label4.Location = new Point(170, 148);
  268.             textBox3.Location = new Point(376, 148);
  269.             button1.Text = "计算";
  270.             label1.Text = "你的回答:";
  271.             label1.Location = new Point(176, 254);
  272.             button2.Text = "输出";
  273.             главнаяToolStripMenuItem.Text = "主";
  274.             настройкиToolStripMenuItem.Text = "设置";
  275.             сменитьЯзыкToolStripMenuItem.Text = "要改变语言:";
  276.             выходToolStripMenuItem.Text = "输出";
  277.             справкаToolStripMenuItem.Text = "帮助";
  278.             оПрограммеToolStripMenuItem.Text = "有关程序";
  279.             button3.Text = "对清楚的领域";
  280.         }
  281.  
  282.         private void русскийToolStripMenuItem_Click_1(object sender, EventArgs e)
  283.         {
  284.             language = 4;
  285.             label2.Text = "Привет.";
  286.             label2.Location = new Point(268, 40);
  287.             label3.Text = "Введите в строку ниже число, корень которого необходимо вычислить.";
  288.             label3.Location = new Point(58, 74);
  289.             label4.Text = "Укажите необходимую точность(<15 знаков):";
  290.             label4.Location = new Point(109, 148);
  291.             textBox3.Location = new Point(422, 148);
  292.             button1.Text = "Вычислить";
  293.             label1.Text = "Ваш ответ: ";
  294.             label1.Location = new Point(171, 254);
  295.             button2.Text = "Выход";
  296.             главнаяToolStripMenuItem.Text = "Главная";
  297.             настройкиToolStripMenuItem.Text = "Настройки";
  298.             сменитьЯзыкToolStripMenuItem.Text = "Сменить язык:";
  299.             выходToolStripMenuItem.Text = "Выход";
  300.             справкаToolStripMenuItem.Text = "Справка";
  301.             оПрограммеToolStripMenuItem.Text = "О программе";
  302.             button3.Text = "Очистить поля";
  303.         }
  304.  
  305.         private void испанскийToolStripMenuItem_Click_1(object sender, EventArgs e)
  306.         {
  307.             language = 2;
  308.             label2.Text = "Saludos.";
  309.             label2.Location = new Point(271, 40);
  310.             label3.Text = "Escriba en la línea por debajo de un número, la raíz de la cual se debe calcular.";
  311.             label3.Location = new Point(37, 74);
  312.             label4.Text = "Especifique la precisión necesaria(<15 caracteres):";
  313.             label4.Location = new Point(93, 148);
  314.             textBox3.Location = new Point(439, 148);
  315.             button1.Text = "Calcular";
  316.             label1.Text = "Su respuesta: ";
  317.             label1.Location = new Point(182, 254);
  318.             button2.Text = "La salida";
  319.             главнаяToolStripMenuItem.Text = "La principal";
  320.             настройкиToolStripMenuItem.Text = "Ajustes";
  321.             сменитьЯзыкToolStripMenuItem.Text = "Cambiar el idioma:";
  322.             выходToolStripMenuItem.Text = "La salida";
  323.             справкаToolStripMenuItem.Text = "Ayuda";
  324.             оПрограммеToolStripMenuItem.Text = "Sobre el programa de";
  325.             button3.Text = "Borrar campos";
  326.         }
  327.  
  328.         private void португальскийToolStripMenuItem_Click_1(object sender, EventArgs e)
  329.         {
  330.             language = 3;
  331.             label2.Text = "Olá.";
  332.             label2.Location = new Point(285, 40);
  333.             label3.Text = "Escreva na linha abaixo do número, cuja raiz é a necessidade de calcular.";
  334.             label3.Location = new Point(59, 74);
  335.             label4.Text = "Especifique a precisão(<15 caracteres):";
  336.             label4.Location = new Point(133, 148);
  337.             textBox3.Location = new Point(399, 148);
  338.             button1.Text = "Calcular";
  339.             label1.Text = "Sua resposta: ";
  340.             label1.Location = new Point(182, 254);
  341.             button2.Text = "Saída";
  342.             главнаяToolStripMenuItem.Text = "Página principal";
  343.             настройкиToolStripMenuItem.Text = "Configuração";
  344.             сменитьЯзыкToolStripMenuItem.Text = "Alterar o idioma:";
  345.             выходToolStripMenuItem.Text = "Saída";
  346.             справкаToolStripMenuItem.Text = "Referência";
  347.             оПрограммеToolStripMenuItem.Text = "Sobre o programa";
  348.             button3.Text = "Limpar os campos de";
  349.         }
  350.  
  351.         private void оПрограммеToolStripMenuItem_Click(object sender, EventArgs e)
  352.         {
  353.             if (language == 4)
  354.             {
  355.                 MessageBox.Show("                                                           Добро пожаловать!" +
  356.                                 "\nМы (Семенов Никита, Мосеев Данила, Южанинова Ульяна) представляем вашему вниманию программу для извлечения квадратного корня из чисел.\nВсе права защищены.\nСпособы связи с разработчиками:\nE-mail: moseewd@gmail.com\nТелефоон: +79197085310.", "", MessageBoxButtons.OK);
  357.             }
  358.             if (language == 3)
  359.             {
  360.                 MessageBox.Show("                                                                 Bem-vindo!" +
  361.                                 "\nNós (Semenov Nikita, Danila Moseev, Yuzhaninova Uliana) apresentamos o programa para extrair a raiz dos números.\nTodos os direitos reservados.\nFormas de comunicação com os desenvolvedores:\nE-mail: moseewd@gmail.com\nTelefone: +79197085310.", "", MessageBoxButtons.OK);
  362.             }
  363.             if (language == 2)
  364.             {
  365.                 MessageBox.Show("                                                                 Bienvenido!" +
  366.                                 "\nNosotros (Semenov Nikita, Danila Moseev, Yuzhaninova Uliana) te presentamos el programa para extraer la raíz de números.\nTodos los derechos reservados.\nLa forma de contactar con los desarrolladores:\nE-mail: moseewd@gmail.com\nTeléfono: +79197085310.", "", MessageBoxButtons.OK);
  367.             }
  368.             if (language == 1)
  369.             {
  370.                 MessageBox.Show("                                                                   Welcome!" +
  371.                                 "\nWe (Semenov Nikita, Danila Moseev, Yuzhaninova Uliana) present the program to extract the square root of numbers.\nAll rights reserved.\nCommunication with developers:\nE-mail: moseewd@gmail.com\nPhone: +79197085310.", "", MessageBoxButtons.OK);
  372.             }
  373.             if (language == 0)
  374.             {
  375.                 MessageBox.Show("                                                                    欢迎!" +
  376.                                 "\n我们 (Semenov Nikita, Danila Moseev, Yuzhaninova Uliana) 本程序中提取的数字。\n保留所有权利。\n通信与开发商:\nE-mail: moseewd@gmail.com\n电话: +79197085310.", "", MessageBoxButtons.OK);
  377.             }
  378.         }
  379.  
  380.         private void button3_Click(object sender, EventArgs e)
  381.         {
  382.             textBox1.Text = "";
  383.             textBox2.Text = "";
  384.             textBox3.Text = "";
  385.         }
  386.     }
  387. }
  388.  
  389. //Form2.cs
  390. using System;
  391. using System.Collections.Generic;
  392. using System.ComponentModel;
  393. using System.Data;
  394. using System.Drawing;
  395. using System.Linq;
  396. using System.Text;
  397. using System.Threading.Tasks;
  398. using System.Windows.Forms;
  399.  
  400. namespace WindowsFormsApp2
  401. {
  402.     public partial class Form2 : Form
  403.     {
  404.         public Form2()
  405.         {
  406.             InitializeComponent();
  407.         }
  408.  
  409.         private void button1_Click(object sender, EventArgs e)
  410.         {
  411.             if (domainUpDown1.SelectedItem == null)
  412.             {
  413.                 MessageBox.Show("Язык не выбран!");
  414.                 return;
  415.             }
  416.             Form1.language = domainUpDown1.SelectedIndex;
  417.             Hide();
  418.             Form1 main = new Form1();
  419.             main.ShowDialog();
  420.             Close();
  421.         }
  422.  
  423.         private void button2_Click(object sender, EventArgs e)
  424.         {
  425.             Application.Exit();
  426.         }
  427.     }
  428. }
  429.  
  430. //Program.cs
  431. using System;
  432. using System.Collections.Generic;
  433. using System.Linq;
  434. using System.Threading.Tasks;
  435. using System.Windows.Forms;
  436.  
  437. namespace WindowsFormsApp2
  438. {
  439.     static class Program
  440.     {
  441.         /// <summary>
  442.         /// Главная точка входа для приложения.
  443.         /// </summary>
  444.         [STAThread]
  445.         static void Main()
  446.         {
  447.             Application.EnableVisualStyles();
  448.             Application.SetCompatibleTextRenderingDefault(false);
  449.             Application.Run(new Form2());
  450.         }
  451.     }
  452. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement