Results 1 to 6 of 6

Thread: [RESOLVED] How to Animate resizing of the main form?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    26

    Resolved [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

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    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
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    26

    Thumbs up 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?

  4. #4
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: How to Animate resizing of the main form?

    try this...

    vb Code:
    1. Public Class Form1
    2.  
    3.     Dim Timer1 As New Timer
    4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    5.  
    6.         AddHandler Timer1.Tick, AddressOf Timer1_Tick
    7.         Me.Timer1.Interval = 20
    8.         Me.Timer1.Start()
    9.  
    10.     End Sub
    11.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
    12.  
    13.         Const MAX As Integer = 400
    14.         Const Min As Integer = 200
    15.         Static GettingBigger As Boolean = True
    16.  
    17.         Static mySize As Integer = Min
    18.  
    19.         If GettingBigger Then
    20.             mySize += 1
    21.             If mySize >= MAX Then GettingBigger = False
    22.         Else
    23.             mySize -= 1
    24.             If mySize <= Min Then GettingBigger = True
    25.         End If
    26.         Me.Size = New Size(mySize, mySize)
    27.         Me.Refresh()
    28.  
    29.     End Sub
    30.  
    31. End Class
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    26

    Re: How to Animate resizing of the main form?

    You are DA BOMB..!!!

    That worked pretty well.

  6. #6
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    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
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width