Question Dynamically Expanding Shape

SteveBarker

New member
Joined
Jun 10, 2010
Messages
2
Programming Experience
Beginner
Hey guys,

I am trying to get a line to expand whilst the user hovers over a specific Label or Button, I thought the best way to do this would be using a however so far I cannot get the process to loop until the user stops hovering over the item.

VB.NET:
Public Class Form1

    Dim Sec As Integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Sec = Sec + 1
    End Sub

    Private Sub Label1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseHover
        LineShape1.X2 = sec
    End Sub
End Class

That is pretty much what I have so far, it works however I have to keep hovering and then exiting the Label for the size to increase. I have tried various loops however most of them just end up in an infinite loop.

Just to clarify, I would like the X2 dimension of the Line to increase until the user stops hovering over the form.

Cheers,
Steve
 
Handle the MouseEnter event of the Label and Start the Timer. Handle the MouseLeave event of the Label and Stop the Timer. In the Timer's Tick event handler, increment the LineShape's X2 property.
 
Back
Top