コード例 #1
0
        public Options()
        {
            this._CellSize   = 80;
            this._PieceSize  = 64;
            this._PieceStyle = eChessPieceStyle.Classic1;
            this._BoardStyle = eChessBoardStyle.Metal;
            this.PlaySound   = true;

            LoadOptions();
        }
コード例 #2
0
        public Uc_ChessPiece(eChessSide side, eChessPieceType type, eChessPieceStyle style, int cellSize, int piecesize)
        {
            InitializeComponent();

            this._side  = side;
            this._type  = type;
            this._style = style;
            _cellSize   = cellSize;
            _pieceSize  = piecesize;
            _image      = Read_Image_From_Resources.GetChessPieceBitMap(_side, _type, _style);

            //UserControl Size
            this.Size = new Size(this._pieceSize, this._pieceSize);
        }
コード例 #3
0
ファイル: Form_Promotion.cs プロジェクト: meocong/ChessGame
        public Form_Promotion(eChessSide side, eChessPieceStyle style, System.Globalization.CultureInfo language)
        {
            InitializeComponent();

            //Initalize
            pictureBox1.Image = Read_Image_From_Resources.GetChessPieceBitMap(side, eChessPieceType.Queen, style);
            pictureBox2.Image = Read_Image_From_Resources.GetChessPieceBitMap(side, eChessPieceType.Rook, style);
            pictureBox3.Image = Read_Image_From_Resources.GetChessPieceBitMap(side, eChessPieceType.Knight, style);
            pictureBox4.Image = Read_Image_From_Resources.GetChessPieceBitMap(side, eChessPieceType.Bishop, style);

            //Change Language
            Assembly        a  = Assembly.Load("Chess Library");
            ResourceManager rm = new ResourceManager("Chess_Library.Resources.Lang.Langres", a);

            this.Text = rm.GetString("Form_Promotion", language);
            labelX_form_promotion.Text = rm.GetString("labelX_form_promotion", language);
        }
コード例 #4
0
 public void LoadOptions()
 {
     if (File.Exists(path) == false)
     {
         XML_Processing.CreateNewOptions(path);
         SaveOptions();
     }
     else
     {
         DataTable tbl = XML_Processing.GetTable(path);
         DataRow   r   = tbl.Rows[0];
         this._CellSize   = Convert.ToInt32(r["CELLSIZE"]);
         this._PieceSize  = Convert.ToInt32(r["PIECESIZE"]);
         this._BoardStyle = (eChessBoardStyle)Convert.ToInt32(r["BOARDSTYLE"]);
         this._PieceStyle = (eChessPieceStyle)Convert.ToInt32(r["PIECESTYLE"]);
         this._PlaySound  = Convert.ToBoolean(r["PLAYSOUND"]);
     }
 }
コード例 #5
0
        private void cboBoardStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboBoardStyle.SelectedIndex == -1 || cboChessPieceStyle.SelectedIndex == -1)
            {
                return;
            }

            try
            {
                eChessBoardStyle BoardStyle = (eChessBoardStyle)(cboBoardStyle.SelectedIndex + 1);
                eChessPieceStyle PieceStyle = (eChessPieceStyle)(cboChessPieceStyle.SelectedIndex + 1);

                Uc_ChessBoard board = new Uc_ChessBoard(BoardStyle, PieceStyle, eChessSide.White, eGameMode.VsNetWorkPlayer, 48, 48, false, new CultureInfo("vi"));

                pictureBox1.Image = board.TakePicture(pictureBox1.Width, pictureBox1.Height);
                board.Dispose();
            }
            catch
            {
            }
        }
コード例 #6
0
        /*
         * Hàm này trả về tên của hình ảnh quân cờ chứa trong resource
         * VD: Muon lay quan Mã màu Đen Style Classic
         * Bitmap img=GetChessPieceBitMap(ChessPieceSide.Black,eChessPieceType.Knight,eChessPieceStyle.Classic);
         * Hàm này lấy hình ảnh trong Resource có tên là "Black_K_1";
         */
        public static Bitmap GetChessPieceBitMap(eChessSide Side, eChessPieceType Type, eChessPieceStyle Style)
        {
            string strImg = "";

            switch (Side)
            {
            case eChessSide.Black:
                strImg += "Black_";
                break;

            case eChessSide.White:
                strImg += "White_";
                break;
            }

            switch (Type)
            {
            case eChessPieceType.Pawn:
                strImg += "P_";
                break;

            case eChessPieceType.Bishop:
                strImg += "B_";
                break;

            case eChessPieceType.Knight:
                strImg += "N_";
                break;

            case eChessPieceType.Rook:
                strImg += "R_";
                break;

            case eChessPieceType.Queen:
                strImg += "Q_";
                break;

            case eChessPieceType.King:
                strImg += "K_";
                break;
            }

            strImg += (int)Style;

            Bitmap img = (Bitmap)Properties.Resources.ResourceManager.GetObject(strImg);

            return(img);
        }