Results 1 to 4 of 4

Thread: PictureBox Timer [Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127

    PictureBox Timer [Resolved]

    Is there an easy way to loop the seconds/miliseconds that a picturebox will display a picture before hiding it again and showing the next PictureBox in sequence?

    I haven't had any good results out of this at all.

    Code:
             
                PictureBox7.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox7.Visible = False
                System.Threading.Thread.Sleep(1000)
                PictureBox9.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox9.Visible = False
                System.Threading.Thread.Sleep(1000)
                PictureBox11.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox11.Visible = False
                System.Threading.Thread.Sleep(1000)
                PictureBox13.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox13.Visible = False
                System.Threading.Thread.Sleep(1000)
                PictureBox15.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox15.Visible = False
                System.Threading.Thread.Sleep(1000)
                PictureBox17.Visible = True
                System.Threading.Thread.Sleep(1000)
                PictureBox17.Visible = False
    Last edited by teamdad; Jun 22nd, 2004 at 05:55 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    How about this ?
    VB Code:
    1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2.         If Me.PictureBox1.Visible Then
    3.             Me.PictureBox1.Visible = False
    4.         Else
    5.             Me.PictureBox1.Visible = True
    6.         End If
    7.     End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127
    I think I should have put all the code in for what i'm trying to do.

    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            PictureBox1.Visible = True
            PictureBox2.Visible = False
            PictureBox3.Visible = False
            PictureBox4.Visible = False
           
        End Sub
    
    
    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
    
                Win32.WinMM.PlayWavResource("mojo.wav")
    
               
                System.Threading.Thread.Sleep(1000)
                Me.PictureBox1.Visible = False
                System.Threading.Thread.Sleep(1000)
    
                Me.PictureBox2.Visible = True
                System.Threading.Thread.Sleep(1000)
                Me.PictureBox2.Visible = False
                
                Me.PictureBox3.Visible = True
                System.Threading.Thread.Sleep(1000)
                Me.PictureBox3.Visible = False
                
                Me.PictureBox4.Visible = True
                System.Threading.Thread.Sleep(1000)
                Me.PictureBox4.Visible = False
            
    End Sub
    The form loads with all picture boxes visible = False except for number 1.

    You click on picture box 1 and it starts playing the wav file, it waits a second and hides picture box 1, it then shows picture box 2, waits a second and hises it, then it shows picture box 3, waits a second and then hides it, it shows picture box 4, waits a second and then hides it. By this time the wav file has finished and has stoped playing.

    Lining the picture boxes up side by side and running the program will show the picture in each box advance each second one at a time till it gets to the end.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127
    Keeping this alive and hoping for an answer or a pointer.

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