Form2.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. namespace Praktika409
  11. {
  12. public partial class Form2 : Form
  13. {
  14. public Form2()
  15. {
  16. InitializeComponent();
  17. string[] countries = { "Росиия", "Китай", "Индия", "Северная Корея", "Вьетнам" };
  18. listBox1.Items.AddRange(countries);
  19. }
  20. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  21. {
  22. }
  23. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  24. {
  25. CheckBox checkBox = (CheckBox)sender; // приводим отправителя к элементу типа CheckBox
  26. if (checkBox.Checked == true)
  27. {
  28. MessageBox.Show("Флажок " + checkBox.Text + " теперь отмечен");
  29. }
  30. else
  31. {
  32. MessageBox.Show("Флажок " + checkBox.Text + " теперь не отмечен");
  33. }
  34. }
  35. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  36. {
  37. // приводим отправителя к элементу типа RadioButton
  38. RadioButton radioButton = (RadioButton)sender;
  39. if (radioButton.Checked)
  40. {
  41. MessageBox.Show("Вы выбрали " + radioButton.Text);
  42. }
  43. }
  44. }
  45. }