Imports AForge.Video Imports AForge.Video.DirectShow Imports AForge.Controls Public Class Imagecapture Private videodevices As FilterInfoCollection Private videosource As VideoCaptureDevice Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click End Sub Private Sub Imagecapture_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load videodevices = New FilterInfoCollection(FilterCategory.VideoInputDevice) For Each device As FilterInfo In videodevices ComboBox1.Items.Add(device.Name) Next videosource = New VideoCaptureDevice() End Sub Private Sub btnstartstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstartstop.Click If (videosource.IsRunning) Then videosource.Stop() PictureBox1.Image = Nothing PictureBox1.Invalidate() Else videosource = New VideoCaptureDevice(videodevices(ComboBox1.SelectedIndex).MonikerString) 'set new frame event handler videosource.NewFrame += New NewFrameEventArgs(videosource_newframe) End If End Sub Sub videosource_newframe(ByVal sender As Object, ByVal eventArgs As NewFrameEventArgs) End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)