VintaSoft Twain .NET SDK 14.1: Руководство для .NET разработчика
Vintasoft.WinTwain Namespace / DeviceCameraCollection Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс DeviceCameraCollection
    В этом разделе
    Класс, представляющий набор камер, поддерживаемых TWAIN устройством.
    Объектная модель
    DeviceCameraCollection
    Синтаксис
    'Declaration
    
    Public Class DeviceCameraCollection
    
    
    public class DeviceCameraCollection
    
    
    public __gc class DeviceCameraCollection
    
    
    public ref class DeviceCameraCollection
    
    
    Пример

    Вот C#/VB.NET код, который демонстрирует, как использовать функцию двухпотоков сканера Kodak.

    
    Private Shared Sub AcquiredImagesWithDualStream()
            ' create the device manager
            Using deviceManager As New Vintasoft.Twain.DeviceManager()
                    ' open the device manager
                    deviceManager.Open()
    
                    ' get reference to Kodak scanner
                    Dim device As Vintasoft.Twain.Device = deviceManager.Devices.Find("KODAK Scanner: i1410/i1420/i1440")
    
                    ' disable UI
                    device.ShowUI = False
    
                    ' open device
                    device.Open()
    
                    ' set inches as units of measure
                    device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches
                    ' enable duplex
                    device.DocumentFeeder.DuplexEnabled = True
    
                    ' select color camera
                    device.Cameras.SetSelectedCamera("/Camera_Color_Both")
                    ' set resolution for color images
                    device.Resolution = New Vintasoft.Twain.Resolution(300, 300)
                    ' enable color camera
                    device.Cameras.EnableSelectedCamera()
    
                    ' select black-white camera
                    device.Cameras.SetSelectedCamera("/Camera_Bitonal_Both")
                    ' set resolution for black-white images
                    device.Resolution = New Vintasoft.Twain.Resolution(200, 200)
                    ' enable black-white camera
                    device.Cameras.EnableSelectedCamera()
    
    
                    ' modally acquire images from the scanner
                    Dim acquireModalState As Vintasoft.Twain.AcquireModalState = Vintasoft.Twain.AcquireModalState.None
                    Dim acquiredImageInfo As Vintasoft.Twain.ImageInfo
                    Do
                            ' acquire image from scanner
                            acquireModalState = device.AcquireModal()
    
                            ' write information about acquired image
                            If acquireModalState = Vintasoft.Twain.AcquireModalState.ImageAcquired Then
                                    ' get info about acquired image
                                    acquiredImageInfo = device.AcquiredImage.ImageInfo
                                    ' output info about acquired image
                                    System.Console.WriteLine(acquiredImageInfo.PixelType.ToString() & " " & acquiredImageInfo.Resolution.ToString())
    
                                    ' dispose the acquired image
                                    device.AcquiredImage.Dispose()
                            End If
                    Loop While acquireModalState <> Vintasoft.Twain.AcquireModalState.None
    
                    ' close the device
                    device.Close()
    
                    ' close TWAIN device manager
                    deviceManager.Close()
            End Using
    End Sub
    
    
    
    private static void AcquiredImagesWithDualStream()
    {
        // create the device manager
        using (Vintasoft.Twain.DeviceManager deviceManager = new Vintasoft.Twain.DeviceManager())
        {
            // open the device manager
            deviceManager.Open();
    
            // get reference to Kodak scanner
            Vintasoft.Twain.Device device = deviceManager.Devices.Find("KODAK Scanner: i1410/i1420/i1440");
    
            // disable UI
            device.ShowUI = false;
    
            // open device
            device.Open();
    
            // set inches as units of measure
            device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
            // enable duplex
            device.DocumentFeeder.DuplexEnabled = true;
    
            // select color camera
            device.Cameras.SetSelectedCamera("/Camera_Color_Both");
            // set resolution for color images
            device.Resolution = new Vintasoft.Twain.Resolution(300, 300);
            // enable color camera
            device.Cameras.EnableSelectedCamera();
    
            // select black-white camera
            device.Cameras.SetSelectedCamera("/Camera_Bitonal_Both");
            // set resolution for black-white images
            device.Resolution = new Vintasoft.Twain.Resolution(200, 200);
            // enable black-white camera
            device.Cameras.EnableSelectedCamera();
    
    
            // modally acquire images from the scanner
            Vintasoft.Twain.AcquireModalState acquireModalState = Vintasoft.Twain.AcquireModalState.None;
            Vintasoft.Twain.ImageInfo acquiredImageInfo;
            do
            {
                // acquire image from scanner
                acquireModalState = device.AcquireModal();
    
                // write information about acquired image
                if (acquireModalState == Vintasoft.Twain.AcquireModalState.ImageAcquired)
                {
                    // get info about acquired image
                    acquiredImageInfo = device.AcquiredImage.ImageInfo;
                    // output info about acquired image
                    System.Console.WriteLine(acquiredImageInfo.PixelType.ToString() + " " + acquiredImageInfo.Resolution.ToString());
    
                    // dispose the acquired image
                    device.AcquiredImage.Dispose();
                }
            }
            while (acquireModalState != Vintasoft.Twain.AcquireModalState.None);
    
            // close the device
            device.Close();
    
            // close TWAIN device manager
            deviceManager.Close();
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.WinTwain.DeviceCameraCollection

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также