Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

Need help playing an array of hundreds of captured images in a picturebox.

$
0
0
I have this screen recorder that I re-tweaked to store captured images in an array. I'm not sure if the array is storing correctly, but what I do know is that my program crashes when it tries to play the image array in the picturebox. I just want to test to see if the image array is storing correctly by playing it in the Picturebox... this is so I could tweak the autosave later.

I would really appreciate some help with this! My Screen Recorder un-tweaked is at this link.

This is what I have at the top:
Code:

Option Strict On

Imports System.IO
Imports System.Drawing.Image
Imports System.Threading
Imports System.Runtime.InteropServices
Imports System.Text

Public Class Form1

    Dim drag As Boolean
    Dim a As Integer
    Dim b As Integer
  Dim imagevault(1000) As Bitmap

    Dim MonitorWidth As Integer = Screen.PrimaryScreen.Bounds.Width
    Dim MonitorHeight As Integer = Screen.PrimaryScreen.Bounds.Height

The Capture Timer:
Code:

Private Sub VidREC_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VidREC.Tick
        Dim ct As Integer = CInt(ComboBox1.SelectedItem)
        VidREC.Interval = ct

        Label7.Text = "Recording"

        Dim BMP As New System.Drawing.Bitmap(MonitorWidth, MonitorHeight)
        Dim Cap As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(BMP)
        Dim Frames As Integer = Convert.ToInt32(Label3.Text)

        Cap.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)


        imagevault(Frames) = BMP
        Frames = Frames + 1
        Label3.Text = Convert.ToString(Frames)

        If Label1.Text = "stop" Then
            VidREC.Enabled = False
            ComboBox1.SelectedIndex = 3
        End If


        BMP.Dispose()
        Cap.Dispose()
    End Sub

Player:
Code:

Private Sub Player_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Player.Tick

       

        Dim ct As Integer = CInt(ComboBox1.SelectedItem)
        Player.Interval = ct

        Dim CapturedDir As String = s & "\Captured Images\"
        Dim frames As Integer = Convert.ToInt32(Label3.Text)
        Dim counter As Integer = Convert.ToInt32(Label5.Text)

        Label7.Text = "Playing Frames"

       

        PictureBox1.Image = imagevault(counter)

        counter = counter + 1
        Label5.Text = Convert.ToString(counter)

        If counter >= frames Then
            Player.Enabled = False
        End If

        If Label1.Text = "stop" Then
            Player.Enabled = False
        End If

    End Sub


Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>