Hello guys, so I am facing a problem to understand the following.. Creating a GUI based program that has a user control box that contains a list of images of a 52 cards deck, the cards are based on an enum actually 2 enums one for the rank and one for the suit but i can choose the rank and the suit then hit flip and it should show the image of the card.. Now I have the list of images imported as a recourse, but i dont know how to set the images to the enums and how to flip the picture, if somebody can explain it to me it would be nice

Thanks

You shouldn't really use enums for the picture information. You can, but it's a lot more hassle to set it up in a dynamic model

Your pictures will be stored as resources and these resources will be accessible by a key. When you design the key, you should make it so that there is some way for you to determine dynamically which image you need.

So the image key for the 10 of clubs could be "CLUBS_10". This way you can generate the string key from your card information: String.Format("{0}_{1}", theCard.Rank.ToString(), theCard.Value);

To do the actual "flipping", you could animate this in a very simple way by following these steps:
1. Shrink your picture box at a discernible rate, generally, 1/4 the width per second is ok.
2. Ensure that during the shrink, your picture box remains centered to its original position.
3. Once the width reaches 0, change the picture resource from your "Back" image to your "Front" image.
4. Expand the picture box at the same rate (Ensure that the box remains centered!)

commented: Nice suggestion! +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.