MainForm.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 simple_game
  11. {
  12. public partial class MainForm : Form
  13. {
  14. public MainForm()
  15. {
  16. InitializeComponent();
  17. }
  18. private void CheckWin()
  19. {
  20. if (!lblTopLeft.Visible && !lblTopRight.Visible && !lblBottomLeft.Visible && !lblBottomRight.Visible)
  21. {
  22. MessageBox.Show("Поздравляю! Вы сделали что-то(?)");
  23. Close();
  24. }
  25. }
  26. private void btnTopLeft_Click(object sender, EventArgs e)
  27. {
  28. lblBottomRight.Visible = !lblBottomRight.Visible;
  29. CheckWin();
  30. }
  31. private void btnTopRight_Click(object sender, EventArgs e)
  32. {
  33. lblBottomRight.Visible = !lblBottomRight.Visible;
  34. lblBottomLeft.Visible = !lblBottomLeft.Visible;
  35. CheckWin();
  36. }
  37. private void btnBottomLeft_Click(object sender, EventArgs e)
  38. {
  39. lblTopRight.Visible = !lblTopRight.Visible;
  40. lblBottomRight.Visible = !lblBottomRight.Visible;
  41. CheckWin();
  42. }
  43. private void btnBottomRight_Click(object sender, EventArgs e)
  44. {
  45. lblTopLeft.Visible = !lblTopLeft.Visible;
  46. CheckWin();
  47. }
  48. }
  49. }