Beispiel #1
0
        private void CreateField()
        {
            int X, Y = 0;

            for (int i = 0; i < 40; i++)
            {
                X = 0;
                for (int j = 0; j < 40; j++)
                {
                    Field[i, j]             = new CellVisual(i, j);
                    Field[i, j].Location    = new Point(X, Y);
                    Field[i, j].Size        = new Size(20, 20);
                    Field[i, j].BackColor   = Color.White;
                    Field[i, j].BorderStyle = BorderStyle.FixedSingle;
                    Controls.Add(Field[i, j]);
                    Field[i, j].Click += Cell_Click;
                    X = X + 20;
                }
                Y = Y + 20;
            }
            Y = 0;
        }
Beispiel #2
0
        /// <summary>
        /// Обработчик нажатия на клетку
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Cell_Click(object sender, EventArgs e)
        {
            CellVisual Cell = sender as CellVisual;

            CellClicked(Cell.PositionX, Cell.PositionY);
        }