Results 1 to 5 of 5

Thread: Animation

  1. #1

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935

    Exclamation Animation

    I have a form with (to make things simple) a ListBox control and a Frame control, both streching vertically to occupy the height of the whole form.

    As I want to accomodate users running at lower resoltions, I want to make the Frame "autohidable" , meaning that normally I want the ListBox to take up the whole form, and clicking a button makes the Frame slide into view.

    I can do this without animation (just change the Visible property), but how can I make animation to do this? It should be something like the a menu sliding in Windows 98, a task pane sizing in Windows XP, etc.

    I could just do it in a For loop, incrementing the size of the frame by 10 twips each time, but the Frame would resize faster or slower on different systems.

    Just reply if this even makes sense!

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    You could use a timer control, and add the code that do the "animation" in the Timer event. The Timers time event should trigger with the same interval even if the computers CPU varies..
    -= a peet post =-

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    eh.. that came out a bit wrong.. dont't think that one computers cpu will vary that much... but you get my point ?
    -= a peet post =-

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Yep! makes sense to me

    this uses a picture box and a menu item called mnuX
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    Picture1.Left = 0
    Picture1.Width = Me.ScaleWidth
    
    End Sub
    
    Private Sub mnuX_Click()
    
    
    If mnuX.Caption = "hide" Then
      hidePic
    mnuX.Caption = "show"
    Else
    showPic
    mnuX.Caption = "hide"
    
    End If
    
    
    
    End Sub
    
    Private Sub Pause(secs As Single)
    
    Dim sngStopVal As Single
    sngStopVal = Timer + secs
    
    While sngStopVal > Timer
        DoEvents
    
    Wend
    
    End Sub
    
    Private Sub showPic()
    
    
      
      While Picture1.Top > Me.ScaleHeight - Picture1.Height
      
        Picture1.Top = Picture1.Top - 100
        Pause 0.01
      Wend
      
    
    End Sub
    Private Sub hidePic()
     
      While Picture1.Top < Me.Height
      
        Picture1.Top = Picture1.Top + 100
        Pause 0.01
      Wend
    
    End Sub
    Mark
    -------------------

  5. #5

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    While it's not essential to all life on Earth, but will the code produce animation that runs smoother on faster machines and crappier on slower machines?

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