Results 1 to 12 of 12

Thread: [2005] Form and showing a animation

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Lasering's Avatar
    Join Date
    May 2006
    Location
    Lisboa
    Posts
    559

    [2005] Form and showing a animation

    Hi!!

    In my project i added 16 images that form a animation. Then i added a form, in which i added a picture box (Circulo) and a Timer (Timer1).
    Then i added this code:
    Code:
        Dim ImagemActual As Short = 0
        Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
            Timer1.Start()
         End Sub
        Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Dim Imagens(15) As Bitmap
            Imagens(0) = My.Resources.Posicao1
            Imagens(1) = My.Resources.Posicao2
            Imagens(2) = My.Resources.Posicao3
            Imagens(3) = My.Resources.Posicao4
            Imagens(4) = My.Resources.Posicao5
            Imagens(5) = My.Resources.Posicao6
            Imagens(6) = My.Resources.Posicao7
            Imagens(7) = My.Resources.Posicao8
            Imagens(8) = My.Resources.Posicao9
            Imagens(9) = My.Resources.Posicao10
            Imagens(10) = My.Resources.Posicao11
            Imagens(11) = My.Resources.Posicao12
            Imagens(12) = My.Resources.Posicao13
            Imagens(13) = My.Resources.Posicao14
            Imagens(14) = My.Resources.Posicao15
            Imagens(15) = My.Resources.Posicao16
            Circulo.Image = Imagens(ImagemActual)
            Circulo.Update()
            ImagemActual += 1
            If ImagemActual = 15 Then ImagemActual = 0
        End Sub
    With this code when i hit play, the animation in the form works perfectly. But if i add a line like this:
    Code:
        Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
            Timer1.Start()
            UpdateDB()
        End Sub
    UpdateDB is a Sub that does a lot of stuff (opens a file, then changes a DB according to the file)
    If i add this line he does the intire code of UpdateDB() and then he show ONLY the first image of the animation, like the timer isnt working. Can u help me so that he does the code in UpdateDB() and at the same time he shows the animation. If I put Timer1.Start() at the start of UpdateDB() sub its like it is the last thing he does, has if it as on last.
    Last edited by Lasering; Sep 15th, 2007 at 01:41 PM.
    Controls: XPCC|Quantum
    Windows API'sLINQ to XML SamplesRegex Tutorial

    Albert Einstein:
    "Imagination is more important than knowledge."
    "Everything should be made as simple as possible, but not simpler."
    "Great spirits have often encountered violent opposition from weak minds."

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