I asked this question once before and was directed to the Blackjack starter kit. The problem with those cards is they don't look real. Is there anywhere else I can obtain images of playing cards (hopefully free) to use in making my own card game
Spotty, yet another beginners question You really need to read a few books, you know - expand your knowledge.
1. Create a new application.
2. Create a 'MyBankAccount' class
3. Add a method called 'AddMoney'
4. Add a timer to the main form which runs about once a second.
5. In the timer routine, call the 'AddMoney' method of the 'MyBankAccount' class
6. In the 'AddMoney' method, add some money to your 'Balance' Property (e.g. MyBalance = MyBalance + 5) this is left as an exersize on how to add a (positive) balance to a bank account. Negative balances are easy to add.
7. Run your program.
8. Get 'Rich' (You may need to add this property - unfortunately the code takes a good few years to program - in fact, it actually doesn't involve any programming at all, but it still takes a few years...)
Note, you may want to change the amount added in a random fashion, since there's only a finite number of 5's in the world, and you can't keep all of them. Or add a 'Spend' method, but this will reduce the time it takes to Get 'Rich'.
Please excuse my ignorance, but I am not seeing how to assign a card image to a picturebox or other control on a form. I have tried calling Cards.New or Me.Picturebox1.Image = Cards.Card, but I keep getting a "Reference to non-shared member..." warning.
Again, I am sure I am missing something obvious. I would appreciate any suggestions.
Almost all Windows installs (back to V3.0) have c:\windows\system32\cards.dll, a DLL that contains card bitmaps used by Solitaire and Hearts. Here's a VB.NET class you can use to retrieve those bitmaps for your own game:
Public Class Cards
Public ReadOnly Property Card(ByVal which%) As Bitmap '--- Returns a card face bitmap Get Card = mCards(which) End Get End Property
Public ReadOnly Property Back(ByVal which%) As Bitmap '--- Returns a card back bitmap Get Back = mBacks(which) End Get End Property
Declare Auto Function LoadLibraryEx Lib "kernel32.dll" (ByVal fname As String, ByVal dummy As Integer, ByVal flags As Integer) As IntPtr Declare Auto Function FreeLibrary Lib "kernel32.dll" (ByVal hRc As IntPtr) As IntPtr Public Sub New() '--- Load bitmaps from c:\windows\system32\cards.dll Dim hMod As IntPtr = LoadLibraryEx(Environment.SystemDirectory & "\cards.dll", 0, 2) If hMod.Equals(CType(0, IntPtr)) Then Throw New System.Exception("Cards.dll not found") Dim which% For which = 0 To 51 mCards(which) = Bitmap.FromResource(hMod, "#" & CStr(which + 1)) Next For which = 0 To 11 mBacks(which) = Bitmap.FromResource(hMod, "#" & CStr(which + 53)) Next FreeLibrary(hMod) End Sub
Private mCards(51) As Bitmap ' Card face bitmaps Private mBacks(12) As Bitmap ' Card back bitmaps End Class
Really is this anything to do with VB except you may be writing a program using VB which would use some graphic images.
Hey - Can anyone tell me where I can obtain a free house, expensive new car all paid off, unlimited bank account stuffed full of money. Oh and I'm writing a simple application in VB which has nothing to do with the above.
Where can I find real looking playing cards
Bsraju
Spotty, yet another beginners question You really need to read a few books, you know - expand your knowledge.
1. Create a new application.
2. Create a 'MyBankAccount' class
3. Add a method called 'AddMoney'
4. Add a timer to the main form which runs about once a second.
5. In the timer routine, call the 'AddMoney' method of the 'MyBankAccount' class
6. In the 'AddMoney' method, add some money to your 'Balance' Property (e.g. MyBalance = MyBalance + 5) this is left as an exersize on how to add a (positive) balance to a bank account. Negative balances are easy to add.
7. Run your program.
8. Get 'Rich' (You may need to add this property - unfortunately the code takes a good few years to program - in fact, it actually doesn't involve any programming at all, but it still takes a few years...)
Note, you may want to change the amount added in a random fashion, since there's only a finite number of 5's in the world, and you can't keep all of them. Or add a 'Spend' method, but this will reduce the time it takes to Get 'Rich'.
mohamed mwafy
Deborah,
That worked well. The only thing I had to tweak was adding the "New" to the first line:
Thank you!
MattRobins
nobugz,
Please excuse my ignorance, but I am not seeing how to assign a card image to a picturebox or other control on a form. I have tried calling Cards.New or Me.Picturebox1.Image = Cards.Card, but I keep getting a "Reference to non-shared member..." warning.
Again, I am sure I am missing something obvious. I would appreciate any suggestions.
Thank you!
Laputa0122
I didn't try this, but would think you would need to do this:
Dim myCards as Cards
myCards.Card should then work.
Ephi
Try a newsagent or toy store. If you don't like those cards, none other are provided, you can always scan your own.
young.k.joo
Nico V
Public Class Cards
Public ReadOnly Property Card(ByVal which%) As Bitmap
'--- Returns a card face bitmap
Get
Card = mCards(which)
End Get
End Property
Public ReadOnly Property Back(ByVal which%) As Bitmap
'--- Returns a card back bitmap
Get
Back = mBacks(which)
End Get
End Property
Declare Auto Function LoadLibraryEx Lib "kernel32.dll" (ByVal fname As String, ByVal dummy As Integer, ByVal flags As Integer) As IntPtr
Declare Auto Function FreeLibrary Lib "kernel32.dll" (ByVal hRc As IntPtr) As IntPtr
Public Sub New()
'--- Load bitmaps from c:\windows\system32\cards.dll
Dim hMod As IntPtr = LoadLibraryEx(Environment.SystemDirectory & "\cards.dll", 0, 2)
If hMod.Equals(CType(0, IntPtr)) Then Throw New System.Exception("Cards.dll not found")
Dim which%
For which = 0 To 51
mCards(which) = Bitmap.FromResource(hMod, "#" & CStr(which + 1))
Next
For which = 0 To 11
mBacks(which) = Bitmap.FromResource(hMod, "#" & CStr(which + 53))
Next
FreeLibrary(hMod)
End Sub
Private mCards(51) As Bitmap ' Card face bitmaps
Private mBacks(12) As Bitmap ' Card back bitmaps
End Class
steffibev
lol - "try a newsagent"
Actually, scanning them was a good idea, although a royal pain. Thank you.
Venkatesh Kumar S
Really is this anything to do with VB except you may be writing a program using VB which would use some graphic images.
Hey - Can anyone tell me where I can obtain a free house, expensive new car all paid off, unlimited bank account stuffed full of money. Oh and I'm writing a simple application in VB which has nothing to do with the above.