Beispiel #1
0
 void AddButtons()
 {
     box          = new GroupBox();
     box.Location = new Point(50, 250);
     box.Size     = new Size(100 * mainfield.Size, 100 * mainfield.Size);
     box.Parent   = this;
     for (int i = 0; i < 6; i++)
     {
         for (int j = 0; j < 6; j++)
         {
             cellArray[i, j]            = new CellControlButton(mainfield, i, j);
             cellArray[i, j].LeftBorder = new BorderControlButton(i, j, Position.Left);
             cellArray[i, j].LeftBorder.PlayerStroke  += mainfield.OpenBorder;
             cellArray[i, j].RightBorder               = new BorderControlButton(i, j, Position.Right);
             cellArray[i, j].RightBorder.PlayerStroke += mainfield.OpenBorder;
             cellArray[i, j].UpBorder = new BorderControlButton(i, j, Position.Up);
             cellArray[i, j].UpBorder.PlayerStroke   += mainfield.OpenBorder;
             cellArray[i, j].DownBorder               = new BorderControlButton(i, j, Position.Down);
             cellArray[i, j].DownBorder.PlayerStroke += mainfield.OpenBorder;
             CellSettings(cellArray[i, j], i, j);
             BorderSettings(cellArray[i, j].LeftBorder, i, j, Position.Left);
             BorderSettings(cellArray[i, j].RightBorder, i, j, Position.Right);
             BorderSettings(cellArray[i, j].UpBorder, i, j, Position.Up);
             BorderSettings(cellArray[i, j].DownBorder, i, j, Position.Down);
         }
     }
 }
Beispiel #2
0
 void CellSettings(CellControlButton cellButton, int i, int j)
 {
     cellButton.Width           = 15; cellButton.Height = 15;
     cellButton.Location        = new Point(j * 37 + 10, i * 37 + 10);
     cellButton.FlatStyle       = FlatStyle.Flat;
     cellButton.BackgroundImage = Properties.Resources.cell;
     cellButton.ForeColor       = SystemColors.Control;
     cellButton.Parent          = box;
 }