Results 1 to 2 of 2

Thread: moving a ball...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Unhappy

    here is what i am trying to do
    i want to move a ball from a fixed point to different other fixed points
    http://24.112.141.149/test/back.jpg
    thats my menu
    http://24.112.141.149/test/ball.gif
    when form loads this ball is at a fixed point, when the user mousevers the menu items (each menu item has a imgBox over it so when the mouse moves over a item i have a way ot capturing what item they are on..
    and i want that ball to come from that fix point and cover the ball thats beside the menu item
    i tried playing around with it but i coudn't get anywhere, any code would be greatly appreciated, thank you


  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Create one big PictureBox called picBackGround (put your background image in it).
    Create a bunch more little PictureBoxes in an array, all called picBall but make them have different indexes.
    Load your ball into picBall(0). This will be the one with the ball in it initially. The others should have no picture loaded in them.
    Play with their BorderStyles and their AutoSizes until you're satisfied. (They should all be the same size - the size of the ball, or all on AutoSize)
    Then, use this code:
    Code:
    Private Sub picBall_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
        Static iLastIndex As Integer
        
        If iLastIndex = Index Then Exit Sub
        Set picBall(Index).Picture = picBall(iLastIndex).Picture
        Set picBall(iLastIndex).Picture = Nothing
        iLastIndex = Index
    End Sub
    Good luck! Have a ball!

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