Gets the video device collection object.
[EditorAttribute(System.Type, System.Type)]public virtual VideoDevices VideoDevices { get; }
Public Overridable ReadOnly Property VideoDevices As VideoDevices public:virtual property VideoDevices^ VideoDevices {VideoDevices^ get();}
A VideoDevices collection object.
The VideoDevices object is used to enumerate the available video capture devices.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl;public TestCtrlSubForm _csbform;public void DevicesExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;// input filestring outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_Source.avi");try{// create the sub form for devices listbox_csbform = new TestCtrlSubForm();_csbform.Load += new EventHandler(Form_Load);_csbform.buttonRefresh.Click += new EventHandler(Refresh_Click);_csbform.List.Click += new EventHandler(List_Click);// show the devices form_csbform.ShowDialog();// get the selected device indexint selectedRenderer = _capturectrl.AudioDevices.Selection;// set the result to what we expect_result = (_csbform.List.SelectedItem != null && _capturectrl.AudioDevices.Selection != -1);}catch (Exception){_result = false;}}void Form_Load(object sender, EventArgs e){// build the audio device listEnumerateDevices(_capturectrl.AudioDevices, _csbform.List);}void List_Click(object sender, EventArgs e){// select the audio deviceSelectRenderer(_capturectrl.AudioDevices, _csbform.List);}void Refresh_Click(object sender, EventArgs e){// refresh audio devicesRefreshDevices(_capturectrl.AudioDevices, _csbform.List);}void EnumerateDevices(AudioDevices Devices, ListBox List){// Build the device's list boxint Selected = -1;// empty the list boxList.Items.Clear();// add the available audio devices to the list boxfor (int i = 0; (i <= (Devices.Count - 1)); i++){List.Items.Add(Devices[i]);if (Devices[i].Selected){Selected = i;}}// highlight the current selectionList.SelectedIndex = Selected;}void RefreshDevices(AudioDevices Devices, ListBox List){string SelectedName = string.Empty;// save the currently selected device's nameif (Devices.Selection >= 0)SelectedName = Devices[Devices.Selection].FriendlyName;// refresh the device collectionDevices.Refresh();// if there was a previously selected device, reselect itif (SelectedName != string.Empty)Devices.Selection = Devices.IndexOf(SelectedName);// rebuild the listboxEnumerateDevices(Devices, List);}void SelectRenderer(AudioDevices Devices, ListBox List){// select the highlighted deviceDevices.Selection = Devices.IndexOf(List.Items[List.SelectedIndex] as Device);}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _capturectrl As CaptureCtrlPublic _csbform As TestCtrlSubFormPublic Sub DevicesExample()' reference the capture control_capturectrl = _form.CaptureCtrl' input fileDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_Source.avi")Try' create the sub form for devices listbox_csbform = New TestCtrlSubForm()AddHandler _csbform.Load, AddressOf Form_LoadAddHandler _csbform.buttonRefresh.Click, AddressOf Refresh_ClickAddHandler _csbform.List.Click, AddressOf List_Click' show the devices form_csbform.ShowDialog()' get the selected device indexDim selectedRenderer As Integer = _capturectrl.AudioDevices.Selection' set the result to what we expect_result = (Not _csbform.List.SelectedItem Is Nothing AndAlso _capturectrl.AudioDevices.Selection <> -1)Catch e1 As Exception_result = FalseEnd TryEnd SubPrivate Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs)' build the audio device listEnumerateDevices(_capturectrl.AudioDevices, _csbform.List)End SubPrivate Sub List_Click(ByVal sender As Object, ByVal e As EventArgs)' select the audio deviceSelectRenderer(_capturectrl.AudioDevices, _csbform.List)End SubPrivate Sub Refresh_Click(ByVal sender As Object, ByVal e As EventArgs)' refresh audio devicesRefreshDevices(_capturectrl.AudioDevices, _csbform.List)End SubPrivate Sub EnumerateDevices(ByVal Devices As AudioDevices, ByVal List As ListBox)' Build the devices list boxDim Selected As Integer = -1' empty the list boxList.Items.Clear()' add the available audio devices to the list boxDim i As Integer = 0Do While (i <= (Devices.Count - 1))List.Items.Add(Devices(i))If Devices(i).Selected ThenSelected = iEnd Ifi += 1Loop' highlight the current selectionList.SelectedIndex = SelectedEnd SubPrivate Sub RefreshDevices(ByVal Devices As AudioDevices, ByVal List As ListBox)Dim SelectedName As String = String.Empty' save the currently selected device's nameIf Devices.Selection >= 0 ThenSelectedName = Devices(Devices.Selection).FriendlyNameEnd If' refresh the device collectionDevices.Refresh()' if there was a previously selected device, reselect itIf SelectedName <> String.Empty ThenDevices.Selection = Devices.IndexOf(SelectedName)End If' rebuild the listboxEnumerateDevices(Devices, List)End SubPrivate Sub SelectRenderer(ByVal Devices As AudioDevices, ByVal List As ListBox)' select the highlighted deviceDevices.Selection = Devices.IndexOf(TryCast(List.Items(List.SelectedIndex), Device))End SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
