[RESOLVED] How to Animate resizing of the main form?
Is there a way to ANIMATE the re-sizing of the main form?
I attempted to the below, but it's a failure.
Code:
Private Sub dropDownToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Dim x As Integer = 454
Dim y As Integer = 355
If state Then
While y <= 589
ClientSize = New System.Drawing.Size(x, y = y + 1)
Me.Refresh()
End While
ToolStripButton1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
state = False
Else
While y >= 355
ClientSize = New System.Drawing.Size(x, y = y - 1)
Me.Refresh()
End While
ToolStripButton1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
state = True
End If
End Sub
Any ideas is appreciated!
Thanks,
Newbiekid
Re: How to Animate resizing of the main form?
I'm not sure what the effect you are going for is, but typically if I am going to animate something manually, I'll use a timer and each time it fires, change the value(s) that control the animation. In your case, it looks like you would want to increment the y value in the timer, set the client size then call the form's refresh method.
kevin
Re: How to Animate resizing of the main form?
Quote:
Originally Posted by kebo
I'm not sure what the effect you are going for is, but typically if I am going to animate something manually, I'll use a timer and each time it fires, change the value(s) that control the animation. In your case, it looks like you would want to increment the y value in the timer, set the client size then call the form's refresh method.
kevin
Cool!, do you have an example or a link on How to create timer for animation?
Re: How to Animate resizing of the main form?
try this...
vb Code:
Public Class Form1
Dim Timer1 As New Timer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Timer1.Tick, AddressOf Timer1_Tick
Me.Timer1.Interval = 20
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Const MAX As Integer = 400
Const Min As Integer = 200
Static GettingBigger As Boolean = True
Static mySize As Integer = Min
If GettingBigger Then
mySize += 1
If mySize >= MAX Then GettingBigger = False
Else
mySize -= 1
If mySize <= Min Then GettingBigger = True
End If
Me.Size = New Size(mySize, mySize)
Me.Refresh()
End Sub
End Class
kevin
Re: How to Animate resizing of the main form?
You are DA BOMB..!!!
That worked pretty well.
Re: [RESOLVED] How to Animate resizing of the main form?
cool...now rewrite it to fit your app and show me that you learned how to do it :cool:
kevin