//public FormMenuInGame(Form parentForm, MyBoardGame myBoardGame,BoardPinch myBoard) //{ // InitializeComponent(); // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // this.parentForm = parentForm; // this.myBoardGame = myBoardGame; // myBoardPinch = myBoard; // typeBoard = "makNeeb"; //} private void btn_save_Click(object sender, EventArgs e) { this.Enabled = false; // lock this form , FormSavePage form = new FormSavePage(this, myBoardGame); // load save form. form.Show(); //Hide(); //form.Size.Width / 2; //form.Size.Height / 2; form.Location = new Point(this.Location.X + (this.Width / 2) - (form.Size.Width / 2), this.Location.Y + (this.Height / 2) - (form.Size.Height / 2)); }
private void btn_export_Click(object sender, EventArgs e) { int[,] tablePlayerHolder = new int[boardHeight, boardWidth]; int[,] tableStatusItem = new int[boardHeight, boardWidth]; int count_player1 = 0; int count_player2 = 0; for (int i = 0; i < boardHeight; i++) { for (int j = 0; j < boardWidth; j++) { if (btnSection[i, j].BackColor == btn_status[1]) { tablePlayerHolder[i, j] = 1; tableStatusItem[i, j] = 1; count_player1++; } else if (btnSection[i, j].BackColor == btn_status[2]) { tablePlayerHolder[i, j] = 1; if (radio_makNeeb.Checked) // mak neeb not hav super. { tableStatusItem[i, j] = 1; } else { tableStatusItem[i, j] = 2; } count_player1++; } else if (btnSection[i, j].BackColor == btn_status[3]) { tablePlayerHolder[i, j] = 2; tableStatusItem[i, j] = 1; count_player2++; } else if (btnSection[i, j].BackColor == btn_status[4]) { tablePlayerHolder[i, j] = 2; if (radio_makNeeb.Checked) // mak neeb not hav super. { tableStatusItem[i, j] = 1; } else { tableStatusItem[i, j] = 2; } count_player2++; } else { tablePlayerHolder[i, j] = 0; tableStatusItem[i, j] = 0; } // set Hsuper , prevent bug. if (i == 0 && btnSection[i, j].BackColor == btn_status[3]) { tableStatusItem[i, j] = 2; } else if (i == boardHeight - 1 && btnSection[i, j].BackColor == btn_status[1]) { tableStatusItem[i, j] = 2; } } } if (count_player1 > 0 && count_player1 <= 20 && count_player2 > 0 && count_player1 <= 20) { //MessageBox.Show(count_player1 + " - " + count_player2); if (radio_makHorse.Checked) { myBoardGame.setTypeBoard("Mak Horse"); } else if (radio_makNeeb.Checked) { myBoardGame.setTypeBoard("Mak Neeb"); } myBoardGame.clearData(); myBoardGame.setSizeBoard(boardWidth, boardHeight); myBoardGame.updateTableTolist(tablePlayerHolder, tableStatusItem); FormSavePage form = new FormSavePage(this, myBoardGame); // load save form. form.Show(); //Hide(); form.Location = new Point(this.Location.X + (this.Width / 4), this.Location.Y + (this.Height / 4)); } else { MessageBox.Show("Sorry , each player should have item more than 1 and less than 20."); } }