Pavle_nis

Quiz Form2

Oct 19th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 22.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication4
  12. {
  13.     public partial class Form2 : Form
  14.     {
  15.         public Form2()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.         int islide = 0;
  20.         private void Form2_Load(object sender, EventArgs e)
  21.         {
  22.             button1.Text = "START";
  23.             radioButton1.Checked = false;
  24.             radioButton2.Checked = false;
  25.             radioButton3.Checked = false;
  26.             radioButton4.Checked = false;
  27.         }
  28.         private void Question1()
  29.         {
  30.             label1.Text = "Which has the highest mountain?";
  31.             radioButton1.Text = "Mercury";
  32.             radioButton2.Text = "Earth";
  33.             radioButton3.Text = "Venus";
  34.             radioButton4.Text = "Mars";
  35.         }
  36.  
  37.         private void Question2()
  38.         {
  39.             label1.Text = " Which insect accurately indicates the air temperature?";
  40.             radioButton1.Text = "House Fly";
  41.             radioButton2.Text = "Cricket";
  42.             radioButton3.Text = "Mosquito";
  43.             radioButton4.Text = "Dragonfly";
  44.  
  45.         }
  46.  
  47.         private void Question3()
  48.         {
  49.             label1.Text = "How many men have walked on the moon?";
  50.             radioButton1.Text = "5";
  51.             radioButton2.Text = "8";
  52.             radioButton3.Text = "14";
  53.             radioButton4.Text = "12";
  54.         }
  55.  
  56.         private void Question4()
  57.         {
  58.             label1.Text = "In which country is the world's largest McDonalds Restaurant?";
  59.             radioButton1.Text = "China";
  60.             radioButton2.Text = "Usa";
  61.             radioButton3.Text = "Japan";
  62.             radioButton4.Text = "India";
  63.         }
  64.  
  65.         private void Question5()
  66.         {
  67.             label1.Text = "Who has won the FIFA world player award for 2015?";
  68.             radioButton1.Text = " Cristiano Ronaldo";
  69.             radioButton2.Text = "Lionel Messi";
  70.             radioButton3.Text = "Neymar";
  71.             radioButton4.Text = "Luis Suárez";
  72.         }
  73.  
  74.         private void Question6()
  75.         {
  76.             label1.Text = "World water day is celebrated every year on -";
  77.             radioButton1.Text = "June 23";
  78.             radioButton2.Text = "May 15";
  79.             radioButton3.Text = "July 21";
  80.             radioButton4.Text = "March 22";
  81.         }
  82.  
  83.         private void Question7()
  84.         {
  85.             label1.Text = "Formic acid is produced by -";
  86.             radioButton1.Text = "White ants";
  87.             radioButton2.Text = "Cockroaches";
  88.             radioButton3.Text = "Red ants";
  89.             radioButton4.Text = "Mosquitoes";
  90.         }
  91.  
  92.         private void Question8()
  93.         {
  94.             label1.Text = "The most healthy edible oil for heart is";
  95.             radioButton1.Text = "Butter oil";
  96.             radioButton2.Text = "Olive oil";
  97.             radioButton3.Text = "Rape-seed oil";
  98.             radioButton4.Text = "Mustard oil";
  99.         }
  100.  
  101.         private void Question9()
  102.         {
  103.             label1.Text = "Which animal kills more people than any other animal in Africa?";
  104.             radioButton1.Text = "Tiger";
  105.             radioButton2.Text = "Lion";
  106.             radioButton3.Text = "Hippopotamus";
  107.             radioButton4.Text = "Leopard";
  108.         }
  109.  
  110.         private void Question10()
  111.         {
  112.             label1.Text = "Myanmar is the new name of";
  113.             radioButton1.Text = "Thailand";
  114.             radioButton2.Text = "Burma";
  115.             radioButton3.Text = "Philippines";
  116.             radioButton4.Text = "Vietnam";
  117.         }
  118.  
  119.         private void Question11()
  120.         {
  121.             label1.Text = "The newest country in the world is";
  122.             radioButton1.Text = "South Sudan";
  123.             radioButton2.Text = "Kosovo";
  124.             radioButton3.Text = "East Trimor";
  125.             radioButton4.Text = "Palau";
  126.         }
  127.  
  128.         private void Question12()
  129.         {
  130.             label1.Text = "Where did Industrial revolution take place?";
  131.             radioButton1.Text = "Germany";
  132.             radioButton2.Text = "England";
  133.             radioButton3.Text = "France";
  134.             radioButton4.Text = "USA";
  135.         }
  136.  
  137.         private void Question13()
  138.         {
  139.             label1.Text = "The world's tallest free-standing structure is";
  140.             radioButton1.Text = "Eiffel Tower";
  141.             radioButton2.Text = "Leaning Tower of Pisa";
  142.             radioButton3.Text = "CN Tower";
  143.             radioButton4.Text = "Qutab Minar";
  144.         }
  145.  
  146.         private void Question14()
  147.         {
  148.             label1.Text = "The least distance of distinct vision is";
  149.             radioButton1.Text = "35 cm";
  150.             radioButton2.Text = "25 cm";
  151.             radioButton3.Text = "45 cm";
  152.             radioButton4.Text = "15 cm";
  153.         }
  154.  
  155.         private void Question15()
  156.         {
  157.             label1.Text = "Which country is the leading producer of Uranium?";
  158.             radioButton1.Text = "Kazakhstan";
  159.             radioButton2.Text = "Russia";
  160.             radioButton3.Text = "France";
  161.             radioButton4.Text = "Canada";
  162.         }
  163.         private void Question16()
  164.         {
  165.             label1.Text = "aWhich country is the leading producer of Uranium?";
  166.             radioButton1.Text = "Kazakhstan";
  167.             radioButton2.Text = "Russia";
  168.             radioButton3.Text = "France";
  169.             radioButton4.Text = "Canada";
  170.  
  171.         }
  172.         private void radioButton3_CheckedChanged(object sender, EventArgs e)
  173.         {
  174.  
  175.             if (button1.Text == "7" && radioButton3.Checked == true)
  176.             {
  177.                 radioButton3.BackColor = Color.Green;
  178.                 button1.Enabled = true;
  179.             }
  180.  
  181.             if (button1.Text == "9" && radioButton3.Checked == true)
  182.             {
  183.                 radioButton3.BackColor = Color.Green;
  184.                 button1.Enabled = true;
  185.             }
  186.  
  187.             if (button1.Text == "13" && radioButton3.Checked == true)
  188.             {
  189.                 radioButton3.BackColor = Color.Green;
  190.                 button1.Enabled = true;
  191.             }
  192.             if ((button1.Text == "1" || button1.Text == "2" || button1.Text == "3" || button1.Text == "4" || button1.Text == "5" || button1.Text == "6" || button1.Text == "11" || button1.Text == "8" || button1.Text == "15" || button1.Text == "10" || button1.Text == "12" || button1.Text == "15" && (radioButton3.Checked == true)))
  193.             {
  194.                 //radioButton3.BackColor = Color.Red;
  195.                 this.Hide();
  196.                 Form1 form1 = new Form1();
  197.                 form1.Show();
  198.             }
  199.         }
  200.  
  201.         private void radioButton4_CheckedChanged(object sender, EventArgs e)
  202.         {
  203.  
  204.             if (button1.Text == "1" && radioButton4.Checked == true)
  205.             {
  206.                 radioButton4.BackColor = Color.Green;
  207.                 button1.Enabled = true;
  208.             }
  209.             if (button1.Text == "3" && radioButton4.Checked == true)
  210.             {
  211.                 radioButton4.BackColor = Color.Green;
  212.                 button1.Enabled = true;
  213.             }
  214.             if (button1.Text == "6" && radioButton4.Checked == true)
  215.             {
  216.                 radioButton4.BackColor = Color.Green;
  217.                 button1.Enabled = true;
  218.             }
  219.             if ((button1.Text == "2" || button1.Text == "4" || button1.Text == "5" || button1.Text == "7" || button1.Text == "8" || button1.Text == "9" || button1.Text == "10" || button1.Text == "11" || button1.Text == "12" || button1.Text == "13" || button1.Text == "15" || button1.Text == "14" && (radioButton4.Checked == true)))
  220.             {
  221.                 //radioButton4.BackColor = Color.Red;
  222.                 //    my_sound.Play();
  223.                 this.Hide();
  224.                 Form1 form1 = new Form1();
  225.                 form1.Show();
  226.             }
  227.         }
  228.  
  229.  
  230.         private void radioButton1_CheckedChanged(object sender, EventArgs e)
  231.         {
  232.             if (button1.Text == "11" && radioButton1.Checked == true)
  233.             {
  234.                 radioButton1.BackColor = Color.Green;
  235.                 button1.Enabled = true;
  236.             }
  237.             if (button1.Text == "15" && radioButton1.Checked == true)
  238.             {
  239.                 radioButton1.BackColor = Color.Green;
  240.                 button1.Enabled = true;
  241.                 MessageBox.Show("WELL DONE!!!");
  242.             }
  243.             if ((button1.Text == "1" || button1.Text == "2" || button1.Text == "3" || button1.Text == "4" || button1.Text == "5" || button1.Text == "6" || button1.Text == "7" || button1.Text == "8" || button1.Text == "9" || button1.Text == "10" || button1.Text == "12" || button1.Text == "13" && (radioButton1.Checked == true)))
  244.             {
  245.                 radioButton1.BackColor = Color.Red;
  246.                 //  my_sound.Play();
  247.                 this.Hide();
  248.                 Form1 form1 = new Form1();
  249.                 form1.Show();
  250.  
  251.             }
  252.         }
  253.  
  254.         private void radioButton2_CheckedChanged(object sender, EventArgs e)
  255.         {
  256.  
  257.             if (button1.Text == "2" && radioButton2.Checked == true)
  258.             {
  259.                 radioButton2.BackColor = Color.Green;
  260.                 button1.Enabled = true;
  261.             }
  262.             if (button1.Text == "5" && radioButton2.Checked == true)
  263.             {
  264.                 radioButton2.BackColor = Color.Green;
  265.                 button1.Enabled = true;
  266.             }
  267.             if (button1.Text == "8" && radioButton2.Checked == true)
  268.             {
  269.                 radioButton2.BackColor = Color.Green;
  270.                 button1.Enabled = true;
  271.             }
  272.             if (button1.Text == "10" && radioButton2.Checked == true)
  273.             {
  274.                 radioButton2.BackColor = Color.Green;
  275.                 button1.Enabled = true;
  276.             }
  277.             if (button1.Text == "12" && radioButton2.Checked == true)
  278.             {
  279.                 radioButton2.BackColor = Color.Green;
  280.                 button1.Enabled = true;
  281.             }
  282.             if (button1.Text == "14" && radioButton2.Checked == true)
  283.             {
  284.                 radioButton2.BackColor = Color.Green;
  285.                 button1.Enabled = true;
  286.             }
  287.             if (button1.Text == "4" && radioButton2.Checked == true)
  288.             {
  289.                 radioButton2.BackColor = Color.Green;
  290.                 button1.Enabled = true;
  291.             }
  292.             if ((button1.Text == "1" || button1.Text == "3" || button1.Text == "6" || button1.Text == "7" || button1.Text == "11" || button1.Text == "9" || button1.Text == "13" || button1.Text == "15" && (radioButton2.Checked == true)))
  293.             {
  294.                 radioButton2.BackColor = Color.Red;
  295.                 //  my_sound.Play();
  296.                 this.Hide();
  297.                 Form1 form1 = new Form1();
  298.                 form1.Show();
  299.  
  300.             }
  301.         }
  302.  
  303.         private void button1_Click(object sender, EventArgs e)
  304.         {
  305.             //button1.Text = "0";
  306.             radioButton1.Checked = false;
  307.             radioButton2.Checked = false;
  308.             radioButton3.Checked = false;
  309.             radioButton4.Checked = false;
  310.  
  311.             radioButton1.Visible = true;
  312.             radioButton2.Visible = true;
  313.             radioButton3.Visible = true;
  314.             radioButton4.Visible = true;
  315.  
  316.  
  317.             islide = islide + 1;
  318.  
  319.             {
  320.                 switch (islide)
  321.                 {
  322.  
  323.                     case 1:
  324.  
  325.                         Question1();
  326.  
  327.  
  328.                         button1.Enabled = false;
  329.                         button1.Text = Convert.ToString(islide);
  330.  
  331.  
  332.                       //  button1.ForeColor = Color.Black;
  333.                         radioButton1.Checked = false;
  334.                         radioButton2.Checked = false;
  335.                         radioButton3.Checked = false;
  336.                         radioButton4.Checked = false;
  337.  
  338.                     /*    radioButton1.BackColor = Color.RoyalBlue;
  339.                         radioButton2.BackColor = Color.RoyalBlue;
  340.                         radioButton3.BackColor = Color.RoyalBlue;
  341.                         radioButton4.BackColor = Color.RoyalBlue;*/
  342.                         break;
  343.                     case 2:
  344.                         Question2();
  345.                         label3.Text = "1";
  346.  
  347.                         button1.Text = Convert.ToString(islide);
  348.  
  349.                         button1.Enabled = false;
  350.  
  351.                         radioButton1.Checked = false;
  352.                         radioButton2.Checked = false;
  353.                         radioButton3.Checked = false;
  354.                         radioButton4.Checked = false;
  355.  
  356.                         radioButton1.BackColor = Color.RoyalBlue;
  357.                         radioButton2.BackColor = Color.RoyalBlue;
  358.                         radioButton3.BackColor = Color.RoyalBlue;
  359.                         radioButton4.BackColor = Color.RoyalBlue;
  360.                         break;
  361.                     case 3:
  362.                         Question3();
  363.                         label3.Text = "2";
  364.                         button1.Text = Convert.ToString(islide);
  365.                         button1.Enabled = false;
  366.  
  367.                         radioButton1.Checked = false;
  368.                         radioButton2.Checked = false;
  369.                         radioButton3.Checked = false;
  370.                         radioButton4.Checked = false;
  371.  
  372.                         radioButton1.BackColor = Color.RoyalBlue;
  373.                         radioButton2.BackColor = Color.RoyalBlue;
  374.                         radioButton3.BackColor = Color.RoyalBlue;
  375.                         radioButton4.BackColor = Color.RoyalBlue;
  376.                         break;
  377.                     case 4:
  378.                         label3.Text = "3";
  379.                         Question4();
  380.                         button1.Text = Convert.ToString(islide);
  381.                         button1.Enabled = false;
  382.  
  383.                         radioButton1.Checked = false;
  384.                         radioButton2.Checked = false;
  385.                         radioButton3.Checked = false;
  386.                         radioButton4.Checked = false;
  387.  
  388.                         radioButton1.BackColor = Color.RoyalBlue;
  389.                         radioButton2.BackColor = Color.RoyalBlue;
  390.                         radioButton3.BackColor = Color.RoyalBlue;
  391.                         radioButton4.BackColor = Color.RoyalBlue;
  392.                         break;
  393.                     case 5:
  394.                         Question5();
  395.                         label3.Text = "4";
  396.  
  397.                         button1.Text = Convert.ToString(islide);
  398.                         button1.Enabled = false;
  399.  
  400.                         radioButton1.Checked = false;
  401.                         radioButton2.Checked = false;
  402.                         radioButton3.Checked = false;
  403.                         radioButton4.Checked = false;
  404.  
  405.                         radioButton1.BackColor = Color.RoyalBlue;
  406.                         radioButton2.BackColor = Color.RoyalBlue;
  407.                         radioButton3.BackColor = Color.RoyalBlue;
  408.                         radioButton4.BackColor = Color.RoyalBlue;
  409.                         break;
  410.  
  411.                     case 6:
  412.                         label3.Text = "5";
  413.                         Question6();
  414.                         button1.Text = Convert.ToString(islide);
  415.  
  416.                         button1.Enabled = false;
  417.  
  418.                         radioButton1.Checked = false;
  419.                         radioButton2.Checked = false;
  420.                         radioButton3.Checked = false;
  421.                         radioButton4.Checked = false;
  422.  
  423.                         radioButton1.BackColor = Color.RoyalBlue;
  424.                         radioButton2.BackColor = Color.RoyalBlue;
  425.                         radioButton3.BackColor = Color.RoyalBlue;
  426.                         radioButton4.BackColor = Color.RoyalBlue;
  427.                         break;
  428.                     case 7:
  429.                         label3.Text = "6";
  430.                         Question7();
  431.                         button1.Text = Convert.ToString(islide);
  432.  
  433.                         button1.Enabled = false;
  434.  
  435.                         radioButton1.Checked = false;
  436.                         radioButton2.Checked = false;
  437.                         radioButton3.Checked = false;
  438.                         radioButton4.Checked = false;
  439.  
  440.                         radioButton1.BackColor = Color.RoyalBlue;
  441.                         radioButton2.BackColor = Color.RoyalBlue;
  442.                         radioButton3.BackColor = Color.RoyalBlue;
  443.                         radioButton4.BackColor = Color.RoyalBlue;
  444.                         break;
  445.                     case 8:
  446.                         label3.Text = "7";
  447.                         Question8();
  448.                         button1.Text = Convert.ToString(islide);
  449.  
  450.                         button1.Enabled = false;
  451.  
  452.                         radioButton1.Checked = false;
  453.                         radioButton2.Checked = false;
  454.                         radioButton3.Checked = false;
  455.                         radioButton4.Checked = false;
  456.  
  457.                         radioButton1.BackColor = Color.RoyalBlue;
  458.                         radioButton2.BackColor = Color.RoyalBlue;
  459.                         radioButton3.BackColor = Color.RoyalBlue;
  460.                         radioButton4.BackColor = Color.RoyalBlue;
  461.                         break;
  462.                     case 9:
  463.                         label3.Text = "8";
  464.                         Question9();
  465.                         button1.Text = Convert.ToString(islide);
  466.  
  467.                         button1.Enabled = false;
  468.  
  469.                         radioButton1.Checked = false;
  470.                         radioButton2.Checked = false;
  471.                         radioButton3.Checked = false;
  472.                         radioButton4.Checked = false;
  473.  
  474.                         radioButton1.BackColor = Color.RoyalBlue;
  475.                         radioButton2.BackColor = Color.RoyalBlue;
  476.                         radioButton3.BackColor = Color.RoyalBlue;
  477.                         radioButton4.BackColor = Color.RoyalBlue;
  478.                         break;
  479.                     case 10:
  480.                         label3.Text = "9";
  481.                         Question10();
  482.                         button1.Text = Convert.ToString(islide);
  483.                         button1.Enabled = false;
  484.  
  485.                         radioButton1.Checked = false;
  486.                         radioButton2.Checked = false;
  487.                         radioButton3.Checked = false;
  488.                         radioButton4.Checked = false;
  489.  
  490.                         radioButton1.BackColor = Color.RoyalBlue;
  491.                         radioButton2.BackColor = Color.RoyalBlue;
  492.                         radioButton3.BackColor = Color.RoyalBlue;
  493.                         radioButton4.BackColor = Color.RoyalBlue;
  494.                         break;
  495.  
  496.                     case 11:
  497.                         label3.Text = "10";
  498.                         Question11();
  499.                         button1.Text = Convert.ToString(islide);
  500.                         button1.Enabled = false;
  501.  
  502.                         radioButton1.Checked = false;
  503.                         radioButton2.Checked = false;
  504.                         radioButton3.Checked = false;
  505.                         radioButton4.Checked = false;
  506.  
  507.                         radioButton1.BackColor = Color.RoyalBlue;
  508.                         radioButton2.BackColor = Color.RoyalBlue;
  509.                         radioButton3.BackColor = Color.RoyalBlue;
  510.                         radioButton4.BackColor = Color.RoyalBlue;
  511.                         break;
  512.                     case 12:
  513.                         label3.Text = "11";
  514.                         Question12();
  515.                         button1.Text = Convert.ToString(islide);
  516.  
  517.                         button1.Enabled = false;
  518.  
  519.                         radioButton1.Checked = false;
  520.                         radioButton2.Checked = false;
  521.                         radioButton3.Checked = false;
  522.                         radioButton4.Checked = false;
  523.  
  524.                         radioButton1.BackColor = Color.RoyalBlue;
  525.                         radioButton2.BackColor = Color.RoyalBlue;
  526.                         radioButton3.BackColor = Color.RoyalBlue;
  527.                         radioButton4.BackColor = Color.RoyalBlue;
  528.                         break;
  529.                     case 13:
  530.                         label3.Text = "12";
  531.                         Question13();
  532.                         button1.Text = Convert.ToString(islide);
  533.  
  534.                         button1.Enabled = false;
  535.  
  536.                         radioButton1.Checked = false;
  537.                         radioButton2.Checked = false;
  538.                         radioButton3.Checked = false;
  539.                         radioButton4.Checked = false;
  540.  
  541.                         radioButton1.BackColor = Color.RoyalBlue;
  542.                         radioButton2.BackColor = Color.RoyalBlue;
  543.                         radioButton3.BackColor = Color.RoyalBlue;
  544.                         radioButton4.BackColor = Color.RoyalBlue;
  545.                         break;
  546.                     case 14:
  547.                         label3.Text = "13";
  548.                         Question14();
  549.                         button1.Text = Convert.ToString(islide);
  550.  
  551.                         button1.Enabled = false;
  552.  
  553.                         radioButton1.Checked = false;
  554.                         radioButton2.Checked = false;
  555.                         radioButton3.Checked = false;
  556.                         radioButton4.Checked = false;
  557.  
  558.                         radioButton1.BackColor = Color.RoyalBlue;
  559.                         radioButton2.BackColor = Color.RoyalBlue;
  560.                         radioButton3.BackColor = Color.RoyalBlue;
  561.                         radioButton4.BackColor = Color.RoyalBlue;
  562.                         break;
  563.                     case 15:
  564.                         label3.Text = "14";
  565.                         Question15();
  566.                         button1.Text = Convert.ToString(islide);
  567.  
  568.                         button1.Enabled = false;
  569.  
  570.                         radioButton1.Checked = false;
  571.                         radioButton2.Checked = false;
  572.                         radioButton3.Checked = false;
  573.                         radioButton4.Checked = false;
  574.                         radioButton1.BackColor = Color.RoyalBlue;
  575.                         radioButton2.BackColor = Color.RoyalBlue;
  576.                         radioButton3.BackColor = Color.RoyalBlue;
  577.                         radioButton4.BackColor = Color.RoyalBlue;
  578.                         break;
  579.                 }
  580.  
  581.  
  582.  
  583.  
  584.             }
  585.     }
  586.     }
  587. }
Add Comment
Please, Sign In to add comment