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
Visual Basic.NET

Avatar of undefined
Last Comment
Mike Tomlinson

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23