Link to home
Start Free TrialLog in
Avatar of reece withers
reece withers

asked on

MouseHover over ANY picturebox

Hi, I've just finished my game except for this part.

I need to mousehover over any balloon picturebox in my forms to then pop them and animate, but i can do that part myself

I don't know how to make a hover event / function with the way i've approached this

PLEASEE HELP I'M GETTING REALLY DESPERATE :(

Code:

Imports System.Drawing
Imports System.Windows.Forms
Public Class stage1
    Dim holdbox() As PictureBox

    Dim score As Integer = 0

    Private Sub stage1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        tmrSpawn.Start()
        tmrMove.Start()
    End Sub
    Public Sub tmrSpawn_Tick(sender As Object, e As EventArgs) Handles tmrSpawn.Tick
        Dim holdbox(3) As PictureBox
        For i = 1 To 3
            holdbox(i) = New PictureBox
            holdbox(i).Name = "balloon" + Str(i)
            holdbox(i).Image = Image.FromFile("C:\Users\Reece\Desktop\School Work Year 12\VB Projects\PopGame.vb\balloon.png")
            holdbox(i).BackColor = Color.Transparent
            holdbox(i).Location = New Point(((400 - 1 + 1) * Rnd() + 1), 0)
            holdbox(i).Size = New Size(70, 30)
            holdbox(i).Visible = True
            holdbox(i).SizeMode = PictureBoxSizeMode.StretchImage
            Me.Controls.Add(holdbox(i))
        Next
    End Sub

    Private Sub tmrBegin_Tick(sender As Object, e As EventArgs) Handles tmrBegin.Tick
        tmrSpawn.Enabled = True
    End Sub

    Public Sub tmrMove_Tick(sender As Object, e As EventArgs) Handles tmrMove.Tick
        Dim ToLoc As Point
        For Each pic As Control In Me.Controls
            If TypeOf pic Is PictureBox Then
                ToLoc.X = pic.Location.X
                ToLoc.Y = pic.Location.Y + 10
                pic.Location = ToLoc
            End If
        Next
    End Sub

End Class
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial