C#
VB
C++
Gets an index of the currently selected CaptureSize item.
public int Selection { get; set; } Public Property Selection As Integer The zero-based index of the selected item; -1 if no item selected.
Assignment can raise an error exception. For more information, refer to the Error Codes.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public void CaptureSizesExample(){// reference the capture controlCaptureCtrl capturectrl = _form.CaptureCtrl;try{// select a USB video device, use your device name hereif (capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");capturectrl.VideoDevices["USB"].Selected = true;// reference the capture size collectionCaptureSizes sizes = capturectrl.VideoCaptureSizes;// get the current selectionint n = sizes.Selection;// loop through all the capture sizesforeach (CaptureSize cs in sizes){// check some criteria and select oneif (cs.Width == 640 && cs.Height == 480){// select it and breakcs.Selected = true;break;}}// set the result to what we expect_result = (n != sizes.Selection);}catch (Exception){_result = false;}}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public Sub CaptureSizesExample()' reference the capture controlDim capturectrl As CaptureCtrl = _form.CaptureCtrlTry' select a USB video device, use your device name hereIf capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End Ifcapturectrl.VideoDevices("USB").Selected = True' reference the capture size collectionDim sizes As CaptureSizes = capturectrl.VideoCaptureSizes' get the current selectionDim n As Integer = sizes.Selection' loop through all the capture sizesFor Each cs As CaptureSize In sizes' check some criteria and select oneIf cs.Width = 640 AndAlso cs.Height = 480 Then' select it and breakcs.Selected = TrueExit ForEnd IfNext cs' set the result to what we expect_result = (n <> sizes.Selection)Catch e1 As Exception_result = FalseEnd TryEnd Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
