public Options() { this._CellSize = 80; this._PieceSize = 64; this._PieceStyle = eChessPieceStyle.Classic1; this._BoardStyle = eChessBoardStyle.Metal; this.PlaySound = true; LoadOptions(); }
public Uc_ChessCell(Point Position, Bitmap BackImage, eChessSide Side, eChessBoardStyle Style) { InitializeComponent(); this._position.X = Position.X; this._position.Y = Position.Y; this._side = Side; this._boardStyle = Style; this._backImage = BackImage; //Update backimage }
public Uc_ChessCell(Point Position, eChessSide Side, eChessBoardStyle BoardStyle) { InitializeComponent(); this._position.X = Position.X; this._position.Y = Position.Y; this._side = Side; this._boardStyle = BoardStyle; this._backImage = Read_Image_From_Resources.GetChessBoardBitMap(this._side, this._boardStyle); this.BackImage = _backImage; //Update backimage }
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"]); } }
public static Bitmap GetChessBoardBitMap(eChessSide Side, eChessBoardStyle Style) { string strImg = ""; switch (Side) { case eChessSide.Black: strImg += "Black_C_"; break; case eChessSide.White: strImg += "White_C_"; break; } strImg += (int)Style; Bitmap img = (Bitmap)Properties.Resources.ResourceManager.GetObject(strImg); return(img); }
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 { } }