public void SetImage(eBoardCellType i_BoardCellType) { if (i_BoardCellType != m_CurrentCellType) { if (this.Image != null) { this.Image.Dispose(); this.Image = null; } switch (i_BoardCellType) { case eBoardCellType.Empty: this.Image = Properties.Resources.NoChip; break; case eBoardCellType.BlackPlayer: this.Image = Properties.Resources.BlackChip; break; case eBoardCellType.WhitePlayer: this.Image = Properties.Resources.WhiteChip; break; case eBoardCellType.PossibleMove: this.Image = Properties.Resources.PossibleMoveImage; break; } m_CurrentCellType = i_BoardCellType; this.Refresh(); } }
public GraphicBoardCell(int i_Row, int i_Column, int i_CellWidth, int i_CellHeight, eBoardCellType i_CurrentCellType) { r_Row = i_Row; r_Column = i_Column; this.Height = i_CellHeight; this.Width = i_CellWidth; this.SizeMode = PictureBoxSizeMode.StretchImage; this.Enabled = false; SetImage(i_CurrentCellType); }