Results 1 to 5 of 5

Thread: Changing images

  1. #1

    Thread Starter
    Lively Member Skateboarder's Avatar
    Join Date
    Nov 2000
    Location
    Delfzijl, the Netherlands
    Posts
    66

    Talking

    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?
    To VB or not to VB, that's the question...

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    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

  3. #3
    Guest
    This will place Picture2 in Picture1.
    Code:
    Picture1 = Picture2

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    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


  5. #5

    Thread Starter
    Lively Member Skateboarder's Avatar
    Join Date
    Nov 2000
    Location
    Delfzijl, the Netherlands
    Posts
    66

    thanx

    Thanx guys
    To VB or not to VB, that's the question...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width