Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sliding Animation
#1
Hi There, I Am Trying to make a control(Panel)slide down from the top of a window, but I can't get it to work for the life of me... Anyone have an idea?
#2
This code assumes that your Panel is called PNL.

So, here's the basic idea. You want to add a timer to your form with the interval of around 50. Then, insert something like this code.

Code:
Sub hover() handles PNL.MouseEnter
  Timer2.Stop()
  Timer2.Enabled = False
  Timer1.Start()
  Timer1.Enabled = True
End Sub

Sub leave() handles PNL.MouseLeave
  Timer1.Stop()
  Timer1.Enabled = False
  Timer2.Start()
  Timer2.Enabled = True
End Sub

Sub OpenTimerTick handles Timer1.Tick
If PNL.Height < 150
   PNL.Height += 5
End If
End Sub

Sub CloseTimerTick handles Timer2.Tick
If PNL.Height > 0
   PNL.Height -= 5
End If
End Sub

Hopefully this helps. Please note that there may be better ways to do this (Like using only one timer), but I just wrote down the first way that came to mind!
My Blog | My Setup | My Videos | Have a wonderful day.
#3
Thanks Alot! This Helps Greatly!
#4
Hey, no problem!
My Blog | My Setup | My Videos | Have a wonderful day.


Forum Jump:


Users browsing this thread: 1 Guest(s)