okie20
07-08-2004, 01:17 PM
OK, this is my first shot at making a card game ... so any help is appreciated.
What I have done is set up an enum with all the cards and two jokers.
Public Enum card
h2
...
rJoker
bJoker
End Enum
From there I populate an ArrayList with these values, system.random generate a number and pull that index out of the arraylist. This works fine so I said, what the hay, lets try some images. This is where I am stepping into some deeper water. What is the best way to do the images? I thought an imagelist... and also what control is best used to display the cards? picturebox? As you can probably tell I have many questions... thanks in advance!
okie
Iceplug
07-08-2004, 05:33 PM
You can use an array of images or bitmaps for the card images.
The value of the enumeration can indicate the appropriate card image.
To display the cards, a picturebox is fine, although I'd probably use the System.Drawing.Graphics to draw, since it's better for making graphics, especially if you want them to move or change a lot. :)
okie20
07-08-2004, 05:47 PM
Well, all I am trying to do is a lot like 7 card no peek poker ... except there is only three players ... all the cards, plus two jokers. I thought just having an image of a stack of cards that the user will click on, then 'flipping' the card over into a 'showing' state. Kind of like in MS Hearts where all you see are the 12 cards cut off and the last one shown full. Anyway, Im kind of rambling from excitement of doing something new ... no dragging of cards or anything like that. Just clicks. The one question I do have is when a card is flipped over, do I just set a stack of pictureboxes on top of each other? And if that is the case, how do I know which image is going to be on top?
On a side note, how do I shrink a bitmap to fit like a 100x100 frame? This is the case of profiling ... the user has a choice of who to play with and I would like a picture to come up when they choose a certain person... I tried putting an image that extends too much and there isnt something that just fits to the size of the picturebox (that I know of). Any ideas on that one?
okie
Iceplug
07-08-2004, 06:23 PM
If you set the stretch mode of the picturebox to stretch (or autosize, one of them), then you should be able to make the picture scale to be 100x100 (even though it may actually not be that size). You can also draw the image to be 100x100 with Graphics.
To make the cards stack, you can use a stack of pictureboxes. :) You can also draw them in order from bottom to top :).