MainForm.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. /// <summary>
  19. /// Проверка выигрыша
  20. /// </summary>
  21. private void CheckWin()
  22. {
  23. if (!lblTopLeft.Visible && !lblTopRight.Visible && !lblBottomLeft.Visible && !lblBottomRight.Visible)
  24. {
  25. MessageBox.Show("Поздравляю! Вы сделали что-то(?)");
  26. Close();
  27. }
  28. }
  29. /****************/
  30. /* Клики кнопок */
  31. /****************/
  32. private void btnTopLeft_Click(object sender, EventArgs e)
  33. {
  34. lblBottomRight.Visible = !lblBottomRight.Visible;
  35. CheckWin();
  36. }
  37. private void btnTopRight_Click(object sender, EventArgs e)
  38. {
  39. lblBottomRight.Visible = !lblBottomRight.Visible;
  40. lblBottomLeft.Visible = !lblBottomLeft.Visible;
  41. CheckWin();
  42. }
  43. private void btnBottomLeft_Click(object sender, EventArgs e)
  44. {
  45. lblTopRight.Visible = !lblTopRight.Visible;
  46. lblBottomRight.Visible = !lblBottomRight.Visible;
  47. CheckWin();
  48. }
  49. private void btnBottomRight_Click(object sender, EventArgs e)
  50. {
  51. lblTopLeft.Visible = !lblTopLeft.Visible;
  52. CheckWin();
  53. }
  54. }
  55. }