private void btnRecieveAndCreate_Click(object sender, EventArgs e) { frmlangame = new frmLanGameplay(); frmlangame.setGame(LISTCARD); frmlangame.TopLevel = false; frmlangame.MdiParent = this; frmlangame.Show(); frmlangame.Location = new Point(0, 0); panel1.Location = new Point(frmlangame.Width, 0); this.Width = frmlangame.Width + panel1.Width + 30; this.Height = (panel1.Height > frmlangame.Height ? panel1.Height + 30 : frmlangame.Height + 30); frmlangame.DisableAll(); btnRecieveAndCreate.Enabled = false; }
private void btnCreateandSend_Click(object sender, EventArgs e) { if (cbbStyleCard.SelectedIndex == -1 || String.IsNullOrEmpty(tbRow.Text) || String.IsNullOrEmpty(tbCol.Text)) { MessageBoxEx.Show("Nhập đầy đủ thông tin bàn chơi!"); } else if ((Int32.Parse(tbRow.Text) * Int32.Parse(tbCol.Text)) % 2 != 0 || (Int32.Parse(tbRow.Text) * Int32.Parse(tbCol.Text)) > 200) { MessageBoxEx.Show("Tích số cột và dòng là một số chẵn và nhỏ hơn hoặc bằng 200"); } else { int numrow = Int32.Parse(tbRow.Text); int numcol = Int32.Parse(tbCol.Text); string typecard = cbbStyleCard.SelectedItem.ToString(); ListCard listcard = new ListCard(); listcard.setListCard(numcol, numrow, 0, 0, 0, typecard); listcard.randomimage(); frmlangame = new frmLanGameplay(); frmlangame.setGame(listcard); frmlangame.MdiParent = this; frmlangame.Show(); frmlangame.Location = new Point(0, 0); panel1.Location = new Point(frmlangame.Width, 0); this.Width = frmlangame.Width + panel1.Width + 30; this.Height = (panel1.Height > frmlangame.Height ? panel1.Height + 30 : frmlangame.Height + 30); frmlangame.DisableAll(); socket.Send(new SocketData((int)SocketCommand.NOTIFY, "Nhận bàn chơi thành công", null)); socket.Send(new SocketData((int)SocketCommand.SEND_LISTCARD, "", listcard)); btnCreateandSend.Enabled = false; btnPlay.Enabled = true; } }