/// <summary> /// Automatically sets the positions of the SwitchBox visual components /// </summary> /// <param name="position"></param> public override void SetPosition(Vector2 position) { Position = position; _leftArrow.SetPosition(new Vector2(position.X + CaptionMaxWidth, position.Y+5)); _rightArrow.SetPosition(new Vector2(position.X + CaptionMaxWidth + _arrowWidth + MenuMaxWidth, position.Y+5)); var indexerTexture = GameGraphics.GetTexture("left_indexer").SourceTexture; var indexerXPosition = Position.X - indexerTexture.Width - 18; // some offset var indexerYPosition = Position.Y + 3; var indexerPosition = new Vector2(indexerXPosition, indexerYPosition); _indexer = new PictureBox(indexerTexture, new Rectangle(0, 0, indexerTexture.Width, indexerTexture.Height)); _indexer.SetPosition(indexerPosition); _leftArrowButtonArea = _leftArrow.DestinationRectangle; _rightArrowButtonArea = _rightArrow.DestinationRectangle; }
public override void SetPosition(Vector2 position) { Position = position; var LIndexerTexture = GameGraphics.GetTexture("left_indexer").SourceTexture; var RIndexerTexture = GameGraphics.GetTexture("right_indexer").SourceTexture; // setting left indexer var indexerXPosition = Position.X - LIndexerTexture.Width - 18; // some offset var indexerYPosition = Position.Y -3; var indexerPosition = new Vector2(indexerXPosition, indexerYPosition); _leftIndexerPic = new PictureBox(LIndexerTexture, new Rectangle(0, 0, LIndexerTexture.Width, LIndexerTexture.Height)); _leftIndexerPic.SetPosition(indexerPosition); // setting right indexer indexerXPosition = Position.X + SpriteFont.MeasureString(Text).X + 18; indexerPosition = new Vector2(indexerXPosition, indexerYPosition); _rightIndexerPic = new PictureBox(RIndexerTexture, new Rectangle(0, 0, RIndexerTexture.Width, RIndexerTexture.Height)); _rightIndexerPic.SetPosition(indexerPosition); _leftIndexerPic.Fading = true; _rightIndexerPic.Fading = true; }