Beispiel #1
0
 /* Trả lại một quân cờ bị loại khỏi bàn cờ */
 public static void TraLaiQuanCo(PictureBox ptbBanCo, ProgramConfig.RoundPictureBox quanCoCanTraLai)
 {
     if (quanCoCanTraLai != null)
     {
         Alive_QuanCo.Add(quanCoCanTraLai.Quan_Co);
         Alive_RoundPictureBox.Add(quanCoCanTraLai);
         ptbBanCo.Controls.Add(quanCoCanTraLai);
     }
 }
Beispiel #2
0
 /* Xóa các RoundPictureBox quân cờ khỏi bàn cờ và danh sách quân cờ */
 public static void XoaBanCo(PictureBox ptbBanCo)
 {
     ptbBanCo.Controls.Clear();
     TuongXanh = null;
     TuongDo   = null;
     Alive_QuanCo.Clear();
     Alive_RoundPictureBox.Clear();
     NuocDiTruocDo.Clear();
 }
Beispiel #3
0
 public static void LoaiBoQuanCo(Point viTri, PictureBox ptbBanCo)
 {
     QuanCoBiLoai = Alive_RoundPictureBox.Find(element => element.Quan_Co.Mau != PheDuocDanh && element.Quan_Co.ToaDo == viTri);
     if (QuanCoBiLoai != null)
     {
         ptbBanCo.Controls.Remove(QuanCoBiLoai);
         Alive_RoundPictureBox.Remove(QuanCoBiLoai);
         Alive_QuanCo.Remove(QuanCoBiLoai.Quan_Co);
     }
 }
Beispiel #4
0
        /* Tạo 32 RoundPictureBox quân cờ và đưa chúng vào danh sách các quân cờ để quản lý */
        public static void TaoQuanCo(EventHandler QuanCo_Click, PictureBox ptbBanCo)
        {
            if (MauPheTa == 2)
            {
                /* Tướng xanh */
                ProgramConfig.RoundPictureBox tuongXanh = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTuongXanh);
                tuongXanh.Image = global::CoTuongOffline.Properties.Resources.TuongXanh;
                Alive_RoundPictureBox.Add(tuongXanh);

                /* Xe xanh */
                ProgramConfig.RoundPictureBox xeXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoXeXanh1);
                xeXanh1.Image = Properties.Resources.XeXanh;
                Alive_RoundPictureBox.Add(xeXanh1);

                ProgramConfig.RoundPictureBox xeXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoXeXanh2);
                xeXanh2.Image = global::CoTuongOffline.Properties.Resources.XeXanh;
                Alive_RoundPictureBox.Add(xeXanh2);

                /* Mã xanh */
                ProgramConfig.RoundPictureBox maXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoMaXanh1);
                maXanh1.Image = global::CoTuongOffline.Properties.Resources.MaXanh;
                Alive_RoundPictureBox.Add(maXanh1);

                ProgramConfig.RoundPictureBox maXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoMaXanh2);
                maXanh2.Image = global::CoTuongOffline.Properties.Resources.MaXanh;
                Alive_RoundPictureBox.Add(maXanh2);

                /* Tịnh xanh */
                ProgramConfig.RoundPictureBox tinhXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTinhXanh1);
                tinhXanh1.Image = global::CoTuongOffline.Properties.Resources.TinhXanh;
                Alive_RoundPictureBox.Add(tinhXanh1);

                ProgramConfig.RoundPictureBox tinhXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTinhXanh2);
                tinhXanh2.Image = global::CoTuongOffline.Properties.Resources.TinhXanh;
                Alive_RoundPictureBox.Add(tinhXanh2);

                /* Sĩ xanh */
                ProgramConfig.RoundPictureBox siXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoSiXanh1);
                siXanh1.Image = global::CoTuongOffline.Properties.Resources.SiXanh;
                Alive_RoundPictureBox.Add(siXanh1);

                ProgramConfig.RoundPictureBox siXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoSiXanh2);
                siXanh2.Image = global::CoTuongOffline.Properties.Resources.SiXanh;
                Alive_RoundPictureBox.Add(siXanh2);

                /* Pháo xanh */
                ProgramConfig.RoundPictureBox phaoXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoPhaoXanh1);
                phaoXanh1.Image = global::CoTuongOffline.Properties.Resources.PhaoXanh;
                Alive_RoundPictureBox.Add(phaoXanh1);

                ProgramConfig.RoundPictureBox phaoXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoPhaoXanh2);
                phaoXanh2.Image = global::CoTuongOffline.Properties.Resources.PhaoXanh;
                Alive_RoundPictureBox.Add(phaoXanh2);

                /* Tốt xanh */
                ProgramConfig.RoundPictureBox totXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotXanh1);
                totXanh1.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh1);

                ProgramConfig.RoundPictureBox totXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotXanh2);
                totXanh2.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh2);

                ProgramConfig.RoundPictureBox totXanh3 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotXanh3);
                totXanh3.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh3);

                ProgramConfig.RoundPictureBox totXanh4 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotXanh4);
                totXanh4.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh4);

                ProgramConfig.RoundPictureBox totXanh5 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotXanh5);
                totXanh5.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh5);

                /* Tướng đỏ */
                ProgramConfig.RoundPictureBox tuongDo = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTuongDo);
                tuongDo.Image = global::CoTuongOffline.Properties.Resources.TuongDo;
                Alive_RoundPictureBox.Add(tuongDo);

                /* Xe đỏ */
                ProgramConfig.RoundPictureBox xeDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoXeDo1);
                xeDo1.Image = global::CoTuongOffline.Properties.Resources.XeDo;
                Alive_RoundPictureBox.Add(xeDo1);

                ProgramConfig.RoundPictureBox xeDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoXeDo2);
                xeDo2.Image = global::CoTuongOffline.Properties.Resources.XeDo;
                Alive_RoundPictureBox.Add(xeDo2);

                /* Mã đỏ */
                ProgramConfig.RoundPictureBox maDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoMaDo1);
                maDo1.Image = global::CoTuongOffline.Properties.Resources.MaDo;
                Alive_RoundPictureBox.Add(maDo1);

                ProgramConfig.RoundPictureBox maDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoMaDo2);
                maDo2.Image = global::CoTuongOffline.Properties.Resources.MaDo;
                Alive_RoundPictureBox.Add(maDo2);

                /* Tịnh đỏ */
                ProgramConfig.RoundPictureBox tinhDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTinhDo1);
                tinhDo1.Image = global::CoTuongOffline.Properties.Resources.TinhDo;
                Alive_RoundPictureBox.Add(tinhDo1);

                ProgramConfig.RoundPictureBox tinhDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTinhDo2);
                tinhDo2.Image = global::CoTuongOffline.Properties.Resources.TinhDo;
                Alive_RoundPictureBox.Add(tinhDo2);

                /* Sĩ đỏ */
                ProgramConfig.RoundPictureBox siDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoSiDo1);
                siDo1.Image = global::CoTuongOffline.Properties.Resources.SiDo;
                Alive_RoundPictureBox.Add(siDo1);

                ProgramConfig.RoundPictureBox siDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoSiDo2);
                siDo2.Image = global::CoTuongOffline.Properties.Resources.SiDo;
                Alive_RoundPictureBox.Add(siDo2);

                /* Pháo đỏ */
                ProgramConfig.RoundPictureBox phaoDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoPhaoDo1);
                phaoDo1.Image = global::CoTuongOffline.Properties.Resources.PhaoDo;
                Alive_RoundPictureBox.Add(phaoDo1);

                ProgramConfig.RoundPictureBox phaoDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoPhaoDo2);
                phaoDo2.Image = global::CoTuongOffline.Properties.Resources.PhaoDo;
                Alive_RoundPictureBox.Add(phaoDo2);

                /* Tốt đỏ */
                ProgramConfig.RoundPictureBox totDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotDo1);
                totDo1.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo1);

                ProgramConfig.RoundPictureBox totDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotDo2);
                totDo2.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo2);

                ProgramConfig.RoundPictureBox totDo3 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotDo3);
                totDo3.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo3);

                ProgramConfig.RoundPictureBox totDo4 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotDo4);
                totDo4.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo4);

                ProgramConfig.RoundPictureBox totDo5 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheDo.ToaDoTotDo5);
                totDo5.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo5);
            }
            else if (MauPheTa == 1)
            {
                /* Tướng xanh */
                ProgramConfig.RoundPictureBox tuongXanh = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTuongXanh);
                tuongXanh.Image = global::CoTuongOffline.Properties.Resources.TuongXanh;
                Alive_RoundPictureBox.Add(tuongXanh);

                /* Xe xanh */
                ProgramConfig.RoundPictureBox xeXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoXeXanh1);
                xeXanh1.Image = global::CoTuongOffline.Properties.Resources.XeXanh;
                Alive_RoundPictureBox.Add(xeXanh1);

                ProgramConfig.RoundPictureBox xeXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoXeXanh2);
                xeXanh2.Image = global::CoTuongOffline.Properties.Resources.XeXanh;
                Alive_RoundPictureBox.Add(xeXanh2);

                /* Mã xanh */
                ProgramConfig.RoundPictureBox maXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoMaXanh1);
                maXanh1.Image = global::CoTuongOffline.Properties.Resources.MaXanh;
                Alive_RoundPictureBox.Add(maXanh1);

                ProgramConfig.RoundPictureBox maXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoMaXanh2);
                maXanh2.Image = global::CoTuongOffline.Properties.Resources.MaXanh;
                Alive_RoundPictureBox.Add(maXanh2);

                /* Tịnh xanh */
                ProgramConfig.RoundPictureBox tinhXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTinhXanh1);
                tinhXanh1.Image = global::CoTuongOffline.Properties.Resources.TinhXanh;
                Alive_RoundPictureBox.Add(tinhXanh1);

                ProgramConfig.RoundPictureBox tinhXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTinhXanh2);
                tinhXanh2.Image = global::CoTuongOffline.Properties.Resources.TinhXanh;
                Alive_RoundPictureBox.Add(tinhXanh2);

                /* Sĩ xanh */
                ProgramConfig.RoundPictureBox siXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoSiXanh1);
                siXanh1.Image = global::CoTuongOffline.Properties.Resources.SiXanh;
                Alive_RoundPictureBox.Add(siXanh1);

                ProgramConfig.RoundPictureBox siXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoSiXanh2);
                siXanh2.Image = global::CoTuongOffline.Properties.Resources.SiXanh;
                Alive_RoundPictureBox.Add(siXanh2);

                /* Pháo xanh */
                ProgramConfig.RoundPictureBox phaoXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoPhaoXanh1);
                phaoXanh1.Image = global::CoTuongOffline.Properties.Resources.PhaoXanh;
                Alive_RoundPictureBox.Add(phaoXanh1);

                ProgramConfig.RoundPictureBox phaoXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoPhaoXanh2);
                phaoXanh2.Image = global::CoTuongOffline.Properties.Resources.PhaoXanh;
                Alive_RoundPictureBox.Add(phaoXanh2);

                /* Tốt xanh */
                ProgramConfig.RoundPictureBox totXanh1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotXanh1);
                totXanh1.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh1);

                ProgramConfig.RoundPictureBox totXanh2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotXanh2);
                totXanh2.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh2);

                ProgramConfig.RoundPictureBox totXanh3 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotXanh3);
                totXanh3.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh3);

                ProgramConfig.RoundPictureBox totXanh4 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotXanh4);
                totXanh4.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh4);

                ProgramConfig.RoundPictureBox totXanh5 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotXanh5);
                totXanh5.Image = global::CoTuongOffline.Properties.Resources.TotXanh;
                Alive_RoundPictureBox.Add(totXanh5);

                /* Tướng đỏ */
                ProgramConfig.RoundPictureBox tuongDo = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTuongDo);
                tuongDo.Image = global::CoTuongOffline.Properties.Resources.TuongDo;
                Alive_RoundPictureBox.Add(tuongDo);

                /* Xe đỏ */
                ProgramConfig.RoundPictureBox xeDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoXeDo1);
                xeDo1.Image = global::CoTuongOffline.Properties.Resources.XeDo;
                Alive_RoundPictureBox.Add(xeDo1);

                ProgramConfig.RoundPictureBox xeDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoXeDo2);
                xeDo2.Image = global::CoTuongOffline.Properties.Resources.XeDo;
                Alive_RoundPictureBox.Add(xeDo2);

                /* Mã đỏ */
                ProgramConfig.RoundPictureBox maDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoMaDo1);
                maDo1.Image = global::CoTuongOffline.Properties.Resources.MaDo;
                Alive_RoundPictureBox.Add(maDo1);

                ProgramConfig.RoundPictureBox maDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoMaDo2);
                maDo2.Image = global::CoTuongOffline.Properties.Resources.MaDo;
                Alive_RoundPictureBox.Add(maDo2);

                /* Tịnh đỏ */
                ProgramConfig.RoundPictureBox tinhDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTinhDo1);
                tinhDo1.Image = global::CoTuongOffline.Properties.Resources.TinhDo;
                Alive_RoundPictureBox.Add(tinhDo1);

                ProgramConfig.RoundPictureBox tinhDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTinhDo2);
                tinhDo2.Image = global::CoTuongOffline.Properties.Resources.TinhDo;
                Alive_RoundPictureBox.Add(tinhDo2);

                /* Sĩ đỏ */
                ProgramConfig.RoundPictureBox siDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoSiDo1);
                siDo1.Image = global::CoTuongOffline.Properties.Resources.SiDo;
                Alive_RoundPictureBox.Add(siDo1);

                ProgramConfig.RoundPictureBox siDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoSiDo2);
                siDo2.Image = global::CoTuongOffline.Properties.Resources.SiDo;
                Alive_RoundPictureBox.Add(siDo2);

                /* Pháo đỏ */
                ProgramConfig.RoundPictureBox phaoDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoPhaoDo1);
                phaoDo1.Image = global::CoTuongOffline.Properties.Resources.PhaoDo;
                Alive_RoundPictureBox.Add(phaoDo1);

                ProgramConfig.RoundPictureBox phaoDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoPhaoDo2);
                phaoDo2.Image = global::CoTuongOffline.Properties.Resources.PhaoDo;
                Alive_RoundPictureBox.Add(phaoDo2);

                /* Tốt đỏ */
                ProgramConfig.RoundPictureBox totDo1 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotDo1);
                totDo1.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo1);

                ProgramConfig.RoundPictureBox totDo2 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotDo2);
                totDo2.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo2);

                ProgramConfig.RoundPictureBox totDo3 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotDo3);
                totDo3.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo3);

                ProgramConfig.RoundPictureBox totDo4 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotDo4);
                totDo4.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo4);

                ProgramConfig.RoundPictureBox totDo5 = new ProgramConfig.RoundPictureBox(ProgramConfig.ThongSoPheXanh.ToaDoTotDo5);
                totDo5.Image = global::CoTuongOffline.Properties.Resources.TotDo;
                Alive_RoundPictureBox.Add(totDo5);
            }
            foreach (ProgramConfig.RoundPictureBox element in Alive_RoundPictureBox) // Gắn cho mỗi RoundPictureBox quân cờ 1 sự kiện click và xếp nó lên bàn cờ
            {
                element.Click += QuanCo_Click;
                ptbBanCo.Controls.Add(element);
            }
        }