//this method for drawing broard public void DrawBoard(FormGame formGame) { //calc width & height this.width = this.columnLength * cellHight; this.height = this.rowLength * cellHight; // this.mapLocation = new Point(10, 10); Size mapSize = new Size(width, this.height); // formGame.Controls.Remove(this.map); this.map = MyFrameWork.CreateMap(mapLocation, mapSize, "Board", Color.White); this.map.BorderStyle = BorderStyle.FixedSingle; this.map.BorderStyle = BorderStyle.FixedSingle; // formGame.Controls.Add(this.map); }
public void DrawCells() { // // for 0 to 7 rows for (int row = 0; row < this.rowLength; row++) { // for 0 to 7 cols for (int col = 0; col < this.columnLength; col++) { Panel cell = new Panel(); Point cellLocation = new Point(col * this.cellHight, row * this.cellHight); if ((row % 2).Equals(0)) { if ((col % 2).Equals(1)) { string name = $"LC:{col}:{row}"; //light cell cell = MyFrameWork.CreateCell(cellLocation, this.cellSize, this.lightColor, name); } else { //dark cell string name = $"DC:{col}:{row}"; cell = cell = MyFrameWork.CreateCell(cellLocation, this.cellSize, this.darkColor, name); } } else { if ((col % 2).Equals(0)) { //light cell string name = $"LC:{col}:{row}"; cell = MyFrameWork.CreateCell(cellLocation, this.cellSize, this.lightColor, name); } else { //dark cell string name = $"DC:{col}:{row}"; cell = cell = MyFrameWork.CreateCell(cellLocation, this.cellSize, this.darkColor, name); } } this.map.Controls.Add(cell); } } //BackgroundFix(); }
public void DrawPlayersPieces() { foreach (Player player in this.players) { foreach (Piece piece in player.pieces) { string name = player.Id % 2 == 1 ? $"B:{piece.Location.X}:{piece.Location.Y}" : $"W:{piece.Location.X}:{piece.Location.Y}"; Image image = player.Id % 2 == 1 ? global::Dama_IA.Properties.Resources.black : global::Dama_IA.Properties.Resources.white; Point pieceLocation = new Point(piece.Location.X * this.cellHight, piece.Location.Y * this.cellHight); Button p = MyFrameWork.CreatePiece(pieceLocation, this.cellSize, name, this.darkColor, image); p.MouseDown += this.Piece_MouseDown; p.MouseUp += this.Piece_MouseUp; p.MouseMove += this.Piece_MouseMove; this.map.Controls.Add(p); } } }