public CardButton(Card card) { var xOffset = GameScreen.Instance.SPACING_SIZE * card.X; var yOffset = GameScreen.Instance.SPACING_SIZE * card.Y; var startPoint = GameScreen.Instance.BOARD_STARTING_POINT; var cardSize = GameScreen.CARD_SIZE; Name = FormHelpers.CardButtonName; Tag = card; if (card is PlayingCard) { IPlayingCardImage pci = PlayingCardImageFactory.GetImage("flipped_card"); BackgroundImage = pci.ToBitmap(); } if (card is NullCard) { BackgroundImage = Properties.Resources._null; } BackgroundImageLayout = ImageLayout.Stretch; BackColor = Color.White; Left = startPoint.X + xOffset + cardSize * card.X; Top = startPoint.Y + yOffset + cardSize * card.Y; Width = cardSize; Height = cardSize; //Text = card.Symbol.ToString(); ForeColor = Color.White; Font = new Font("Arial", 18, FontStyle.Bold); Click += GameControls.CardButton_Click; }
private static Bitmap GetImage() { IPlayingCardImage pci = PlayingCardImageFactory.GetImage("spades"); return(pci.ToBitmap()); }