public static bool CanFallOn(this Card what, Card on) { bool wRed = what.Suit == Suit.Diamonds || what.Suit == Suit.Hearts; bool oRed = on.Suit == Suit.Diamonds || on.Suit == Suit.Hearts; if (oRed == wRed) return false; return Convert.ToInt32(on.Face) - Convert.ToInt32(what.Face) == 1; }
public CardView(Card card, int column, int row) { InitializeComponent(); Card = card; var file = card.GetFileName().Replace(".png", string.Empty).Replace("-", "_"); BackgroundImage = Resources.ResourceManager.GetObject(file) as Bitmap; this.BackgroundImageLayout = ImageLayout.Stretch; SetLocation(column, row); }