Possible???

Posts 1–7 of 7 · Page 1 of 1
Possible???
Hey i've never attempted this till now, But is it possible to put multiplie images in a picture box and have a pattern like display image 1 second's then display image 2 second's so on.???
@Jason
@NextGen1
I Am asking if this is possible and maybe how to do it?
Thank you.
Like a slideshow?
Dim img As String = "C:\File"

Dim Count As integer = 1

TIMER
Picturebox1.ImageLocation = img & Count & ".jpg"
Count +=1
@Away-
@Nathan
Like this?
Wait i got it thanx
@Jason Request close.
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
02

03
        Dim max As Integer = 5000
04
        Dim rnd As New Random
05
        Dim rand As Integer = rnd.Next(10, max + 1)
06
        Dim i As Integer = 1
07
        Dim number(max - 1) As Integer
08
 
09
        For i = 0 To max - 1
10
            If number(i) = rand Then
11
                rand = rnd.Next(1, max + 1)
12
                i = -1
13
            ElseIf number(i) = 0 Then
14
                number(i) = rand
15
                rand = rnd.Next(1, max + 1)
16
                If i = max - 1 Then
17
                    Exit For
18
                End If
19
                i = -1
20
            End If
21
        Next
22
        Timer1.Interval = number(i)
23
        i += 1
24
 
25
        ChangeImage()
26
    End Sub
27
 
28
    Private Sub ChangeImage()
29
 
30
        Static Dim iImage1 As Integer
31
 
32
        Select Case iImage1
33
            Case 0
34
 
35
                pbNewImage.Visible = True
36
                pbNewImage.Image = My.Resources.imagename
37
                iImage1 += 1
38
            Case 1
39
 
40
                pbNewImage.Visible = True
41
                pbNewImage.Image = My.Resources.imagename
42
                iImage1 += 1
43
            Case 2
44
 
45
                pbNewImage.Visible = True
46
                pbNewImage.Image = My.Resources.imagename
47
                iImage1 += 1
48
            Case 3
49
 
50
                pbNewImage.Visible = True
51
                pbNewImage.Image = My.Resources.imagename
52
                iImage1 += 1
53
            Case 4
54
 
55
                pbNewImage.Visible = True
56
                pbNewImage.Image = My.Resources.imagename
57
                iImage1 = 0
58
 
59
        End Select
60
    End Sub
61
    
62
    Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
63
        Timer1.Start()
64
    End Sub
Create a List(Of Image), store all your images in there. On a given event step 1 more image through the list, it's not hard.

Example:

Create an instance variable:
[highlight=vb.net]
Private imageIndex As Integer = 0
Private imageList As New List(Of Image)
[/highlight]

Create the list
[highlight=vb.net]

'populate the list like this:
imageList.Add(Image.FromFile("Filepathtoimage"))
[/highlight]

On the event:
[highlight=vb.net]
imageIndex += 1
If Not(imageIndex < imageList.Length) Then imageIndex = 0
If (imageList.Length > 0) Then PictureBox1.Image = imageList(imageIndex)
[/highlight]
Quote Originally Posted by Jason View Post
Create a List(Of Image), store all your images in there. On a given event step 1 more image through the list, it's not hard.

Example:

Create an instance variable:
[highlight=vb.net]
Private imageIndex As Integer = 0
Private imageList As New List(Of Image)
[/highlight]

Create the list
[highlight=vb.net]

'populate the list like this:
imageList.Add(Image.FromFile("Filepathtoimage"))
[/highlight]

On the event:
[highlight=vb.net]
imageIndex += 1
If Not(imageIndex < imageList.Length) Then imageIndex = 0
If (imageList.Length > 0) Then PictureBox1.Image = imageList(imageIndex)
[/highlight]
Easier than writing all dat shit above =P
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?