Beispiel #1
0
        // Обробник події manager.PictureBoxSmile.MouseClick(клік мишкою на смайлик).
        private void Smile_Click(object sender, MouseEventArgs e)
        {
            PictureSmile obj = (PictureSmile)sender;

            obj.State = SmileState.Normal;
            // Якщо натиснута ліва кнопка миші.
            if (e.Button == MouseButtons.Left)
            {
                // Завершуємо поточну гру, готуємося до нової гри.
                gameState = GameState.NotStarted;
                manager.label_for_timing.Timing = 0;
                Timing = 0;
                manager.label_for_flags.NumberFlags = minefield.NumberMines;
                timer.Stop();
                CurrrentNumberOpenTiles = 0;
                // Ініціалізуємо новий стан поля(нове розміщення мін).
                minefield.ReSetField();
            }
        }
Beispiel #2
0
 public void InitializeComponent()
 {
     // Ініціалізація компонент(Створення, Розміщення і тд. і тп.).
     this.label_for_flags  = new LabelForFlags();
     this.label_for_timing = new LabelForTiming();
     this.PictureBoxSmile  = new PictureSmile();
     //
     // PictureBoxSmile
     //
     this.PictureBoxSmile.SizeMode = PictureBoxSizeMode.StretchImage;
     this.PictureBoxSmile.Size     = SizeForSmile;
     this.PictureBoxSmile.State    = SmileState.Normal;
     this.PictureBoxSmile.Location = new System.Drawing.Point(this.Width / 2 - this.PictureBoxSmile.Width / 2,
                                                              DistanceToTop);
     this.Controls.Add(this.PictureBoxSmile);
     //
     // LabelForFlags
     //
     this.label_for_flags.Width    = 50;
     this.label_for_flags.Location = new System.Drawing.Point(DistanceToLeft, DistanceToTop);
     this.label_for_flags.Font     = new System.Drawing.Font("MS Reference Sans Serif", 15.75f,
                                                             System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 204);
     this.label_for_flags.BackColor = System.Drawing.Color.DimGray;
     this.label_for_flags.ForeColor = System.Drawing.Color.Maroon;
     this.label_for_flags.AutoSize  = true;
     this.label_for_flags.Text      = "000";
     this.Controls.Add(this.label_for_flags);
     //
     // label_for_timing
     //
     this.label_for_timing.Width = 50;
     this.label_for_timing.Font  = new System.Drawing.Font("MS Reference Sans Serif", 15.75f,
                                                           System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 204);
     this.label_for_timing.BackColor = System.Drawing.Color.DimGray;
     this.label_for_timing.ForeColor = System.Drawing.Color.Maroon;
     this.label_for_timing.AutoSize  = true;
     this.label_for_timing.Location  = new System.Drawing.Point
                                           (this.Width - Manager.DictanceToRight - label_for_timing.Width, DistanceToTop);
     this.label_for_timing.Text = "000";
     this.Controls.Add(this.label_for_timing);
 }