-
I want to make a slot machine game. I have some pictures, you know them, the fruit stuff. I made a slot machine with numbers before, but that's no fun. So i want the same with pictures. Changing the text on a somethin is easy, just like fruit1.caption = "9". But here's my question:
How can I change a picture in a picturebox?
-
Code:
Picture1.Picture = LoadPicture("FileName") '//Where FileName is a valid picture file on your computer
'//Or use the imageList Control (Microsoft Windows Common Controls)
Picture1.Picture = ImageList1.ListImages(Index).Picture '//Where Index is the index of the picture in the imagelist control
HTH
-
This will place Picture2 in Picture1.
Code:
Picture1 = Picture2
-
Code:
Dim MyPic(9) As StdPicture
'Creates An Array of 9 pictures (numbers or whatever)
Private Sub Form_Load()
Set MyPic(0) = LoadPicture(App.Path & "\0.bmp")
'where this would be the '0' picture
'make sure the pictures are in the same directory as your program
'....
'Do this for 1-8 all the way up to 9
Set MyPic(9) = LoadPicture(App.Path & "\9.bmp")
End Sub
Then in your events, do this
[code]
MyPictureBox.Picture = MyPic(0)
'you can set the picture to any of your 9 numbers
-
thanx