Im trying to center a form with 'animation' but the form keeps going to different location every time. heres the code I used
IM TYPING FROM A PHONE
Code:
Dim ToLocX as integer = 0
Dim ToLocY as integer = 0
Dim LocX as integer = 0
Dim LocY as integer = 0
form load
ToLocX = Screen.PrimaryScreen.Bounds. Size.Height / 2
ToLocY = Screen.PrimaryScreen.Bounds. Size.Width / 2
timer
LocX = Me.Location.X
LocY = Me.Location.Y
If Not LocX = ToLocX And Not LocY = ToLocY
If LocX > ToLocX Then
LocX -= 1
Else
LocX += 1
End
If LocY > ToLocY Then
LocY -= 1
Else
LocY += 1
End If
Me.Location = New Point(LocX. LocY)
End If