VintaSoft Twain .NET SDK 15.3: Руководство для .NET разработчика
Vintasoft.Twain Namespace / DeviceCapability Class / SetValue Methods / SetValue(Boolean) Method
Синтаксис Exceptions Example Требования Смотрите также
В этом разделе
    SetValue(Boolean) Метод (DeviceCapability)
    В этом разделе
    Sets the current value of device capability.
    Синтаксис
    'Declaration
    
    Public Overloads Sub SetValue( _
    ByVal value
    New current value of device capability.
    As Boolean _
    )
    public void SetValue(
    bool value
    )
    public: void SetValue(
    bool value
    )
    public:
    void SetValue(
    bool value
    )

    Parameters

    value
    New current value of device capability.
    Исключения
    ИсключениеОписание
    Thrown if device is in wrong state.
    Thrown if error occurs during setting value of capability.
    Пример

    This C#/VB.NET code shows how to enable duplex using capability of device. Thrown if the .NET debugger is used and the function evaluation requires all threads to run.

    
    Private Shared Sub SetDuplexEnabledCapValue()
        Using deviceManager1 As New Vintasoft.Twain.DeviceManager()
            ' open the device manager
            deviceManager1.Open()
    
            ' get reference to the default device
            Dim device As Vintasoft.Twain.Device = deviceManager1.DefaultDevice
    
            ' open the device
            device.Open()
    
            ' get reference to object that manipulates DuplexEnabled capability
            Dim duplexEnabledCap As Vintasoft.Twain.DeviceCapability = device.Capabilities.Find(Vintasoft.Twain.DeviceCapabilityId.DuplexEnabled)
            ' if DuplexEnabled capability supported
            If duplexEnabledCap IsNot Nothing Then
                ' set value of DuplexEnabled capability
                duplexEnabledCap.SetValue(True)
            End If
    
            ' close the device
            device.Close()
    
            ' close the device manager
            deviceManager1.Close()
        End Using
    End Sub
    
    
    
    private static void SetDuplexEnabledCapValue()
    {
        using (Vintasoft.Twain.DeviceManager deviceManager1 = new Vintasoft.Twain.DeviceManager())
        {
            // open the device manager
            deviceManager1.Open();
    
            // get reference to the default device
            Vintasoft.Twain.Device device = deviceManager1.DefaultDevice;
    
            // open the device
            device.Open();
    
            // get reference to object that manipulates DuplexEnabled capability
            Vintasoft.Twain.DeviceCapability duplexEnabledCap = device.Capabilities.Find(Vintasoft.Twain.DeviceCapabilityId.DuplexEnabled);
            // if DuplexEnabled capability supported
            if (duplexEnabledCap != null)
            {
                // set value of DuplexEnabled capability
                duplexEnabledCap.SetValue(true);
            }
    
            // close the device
            device.Close();
    
            // close the device manager
            deviceManager1.Close();
        }
    }
    
    

    Требования

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

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