Click or drag to resize

Device.Acquire Method

Acquires an image from this device.

Namespace:  Atalasoft.Twain
Assembly:  Atalasoft.DotTwain (in Atalasoft.DotTwain.dll) Version: 11.5.0.0.0.156 (.NET 4.6.2, x86)
Syntax
public void Acquire()
Remarks

NOTE: If ThreadingEnabled is set to true, the Device will be closed and a new Device instance will be created for scanning in the worker thread: This is required by the TWAIN specification. You will not be able to access any device properties or methods during the scan and will have to re-open the device after the scan if access to properties or methods are needed.

Examples
FileTransfer Event
Examples
AcquireCS (C#)
private void menuAcquire_Click(object sender, System.EventArgs e)
{
    if (this.device == null)
        this.device = this.acquisition.Devices.Default;

    try
    {
        this.device.Open();

    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
        return;
    }

    if (!SetTransferMethod())
    {
        this.device.Close();
        return;
    }

    this.device.Frame = this.scanRect.ToRectangleF();
    if (this.scanResolution != null)
        this.device.Resolution = new TwainResolution(this.scanResolution.X, this.scanResolution.Y, this.scanResolution.Units);

    this.device.HideInterface = this.menuHideInterface.Checked;
    this.device.ModalAcquire = this.menuAcquireModal.Checked;

    this.device.Acquire();
}
AcquireVB (Visual Basic)
Private  Sub menuAcquire_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    If Me.device Is Nothing Then
        Me.device = Me.acquisition.Devices.Default
    End If

    Try
        Me.device.Open()

    Catch ex As Exception
        MessageBox.Show(ex.Message)
        Return
    End Try

    If Not SetTransferMethod() Then
        Me.device.Close()
        Return
    End If

    Me.device.Frame = Me.scanRect.ToRectangleF()
    If Not Me.scanResolution Is Nothing Then
        Me.device.Resolution = New TwainResolution(Me.scanResolution.X, Me.scanResolution.Y, Me.scanResolution.Units)
    End If

    Me.device.HideInterface = Me.menuHideInterface.Checked
    Me.device.ModalAcquire = Me.menuAcquireModal.Checked

    Me.device.Acquire()
End Sub
See Also