bool PreviewFEN(string strFEN)
        {
            try
            {
                int    size = 45;
                string s    = strFEN.Split(' ')[1];
                if (s.ToUpper() == "W")
                {
                    lblWhoMove.Text = "Quân Trắng Đi Trước";
                }
                else
                {
                    lblWhoMove.Text = " Quân Đen Đi Trước";
                }

                UcChessBoard board = new UcChessBoard(obj.BoardStyle, obj.PieceStyle, ChessSide.White, GameMode.VsNetWorkPlayer, size, size, false, strFEN);
                Bitmap       bmp   = board.TakePicture(size * 8, size * 8);
                pictureBox1.Image = bmp;
                board.Dispose();
                return(true);
            }
            catch
            {
                MessageBox.Show("Dữ Liệu Không Phù Hợp !!!");
                return(false);
            }
        }
示例#2
0
        void Fen2Pic(string strFEN)
        {
            int        size = pictureBox1.Width / 8;
            clsOptions obj  = new clsOptions();

            UcChessBoard board = new UcChessBoard(obj.BoardStyle, obj.PieceStyle, ChessSide.White, GameMode.VsNetWorkPlayer, size, size, false, strFEN);
            Bitmap       bmp   = board.TakePicture(size * 8, size * 8);

            pictureBox1.Image = bmp;
            board.Dispose();
        }
示例#3
0
 private void btnScreenCapture_Click(object sender, EventArgs e)
 {
     if (Board != null)
     {
         try
         {
             Bitmap bmp = Board.TakePicture(Board.Width, Board.Height);
             Clipboard.SetImage(bmp);
             MessageBox.Show("Đã Lưu ảnh Vào ClipBoard");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
示例#4
0
        private void cboBoardStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboBoardStyle.SelectedIndex == -1 || cboPieceStyle.SelectedIndex == -1)
            {
                return;
            }
            try
            {
                ChessBoardStyle BoardStyle = (ChessBoardStyle)(cboBoardStyle.SelectedIndex + 1);

                ChessPieceStyle PieceStyle = (ChessPieceStyle)(cboPieceStyle.SelectedIndex + 1);

                UcChessBoard Board = new UcChessBoard(BoardStyle, PieceStyle, ChessSide.White, GameMode.VsNetWorkPlayer, 48, 48, false, "KQRBNP2/kqrbnp2/8/8/8/8/8/8");
                pictureBox1.Image = Board.TakePicture(pictureBox1.Width, pictureBox1.Height);
                Board.Dispose();
            }
            catch
            {
            }
        }
示例#5
0
        void Load_Options()
        {
            numCellSize.Value  = obj.CellSize;
            numPieceSize.Value = obj.PieceSize;

            cboBoardStyle.SelectedIndex = ((int)obj.BoardStyle) - 1;
            cboPieceStyle.SelectedIndex = ((int)obj.PieceStyle) - 1;

            chkPlaySound.Checked = obj.PlaySound;

            try
            {
                UcChessBoard Board = new UcChessBoard(obj.BoardStyle, obj.PieceStyle, ChessSide.White, GameMode.VsNetWorkPlayer, 48, 48, false, "KQRBNP2/kqrbnp2/8/8/8/8/8/8 w - -");
                pictureBox1.Image = Board.TakePicture(pictureBox1.Width, pictureBox1.Height);
                Board.Dispose();
            }
            catch
            {
            }
        }