After playing with the code below for a few days I stumped at whats going wrong
with the routine. Since this is a part of a larger project I broke the code down to a small section to run on a test form to debug the problem.
Its very basic a form with a picture box 164 by 130 pixels. I use a solid color box to get a better view of what going on.
If you try the code it will shrink the box just like I wanted. But then when I reverse the process it goes all wrong.
Any suggestions would be a greatly appreciated...
Public Class Form1
Public PBH As Integer
Public PBW As Integer
Public times As Integer
Public locx As Integer
Public locy As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Enabled = True
PBH = 130
PBW = 164
times = 10
locx = 60
locy = 60
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Do
PictureBox1.Height = PBH
PictureBox1.Width = PBW
PictureBox1.Location = New Point(locx, locy)
PBH = PBH - 1 : PBW = PBW - 1 : locx = locx + 1 : locy = locy + 1
Call Delay()
If PBH > 0 Then Continue Do
Loop Until PBH = 0
PBH = 1 : PBW = 35
Do
PictureBox1.Height = PBH
PictureBox1.Width = PBW
PictureBox1.Location = New Point(locx, locy)
PBH = PBH + 1 : PBW = PBW + 1 : locx = locx - 1 : locy = locy - 1
Call Delay()
If PBH < 130 Then Continue Do
Loop Until PBH = 130 : Timer1.Enabled = False
End Sub
Public Sub Delay()
For t = 1 To 2500000 : Next t
End Sub
End Class