Atalasoft.DotTwain Send comments on this topic.
ImageAcquired Event
See Also  Example
Atalasoft.Twain Namespace > Acquisition Class : ImageAcquired Event




This event will fire for each image acquired.

Syntax

Visual Basic (Declaration) 
Public Event ImageAcquired() As ImageAcquiredEventHandler
Visual Basic (Usage)Copy Code
Dim instance As Acquisition
Dim handler As ImageAcquiredEventHandler
 
AddHandler instance.ImageAcquired, handler
C# 
public event ImageAcquiredEventHandler ImageAcquired()
Managed Extensions for C++ 
public: __event ImageAcquiredEventHandler* ImageAcquired();
C++/CLI 
public:
event ImageAcquiredEventHandler^ ImageAcquired();

Event Data

The event handler receives an argument of type AcquireEventArgs containing data related to this event. The following AcquireEventArgs properties provide information specific to this event.

PropertyDescription
CancelPending Gets or sets a value which determines if the pending images will be acquired.
EndOfJob Gets a value indicating whether this is the last image in a batch job.
ExtendedImageInfo Gets a Hashtable containing extended image information retrieved from the device for this acquisition.
FileName Gets the filename of the image when acquired to file.
Image Gets the Bitmap image acquired.
PendingImages Gets the number of images waiting to be acquired.

Example

The example below loads the image or filename passed by the AcquireEventArgs into a PictureBox.
C#Copy Code
private void acquisition_ImageAcquired(object sender, Atalasoft.Twain.AcquireEventArgs e)
{
   
if (e.Image != null)
       
this.pictureBox1.Image = e.Image;
   
else if (e.FileName != null && File.Exists(e.FileName))
       
this.pictureBox1.Image = Image.FromFile(e.FileName);
}

Visual BasicCopy Code
Private Sub acquisition_ImageAcquired(ByVal sender As Object, ByVal e As Atalasoft.Twain.AcquireEventArgs)
    If Not e.Image Is Nothing Then
        Me.pictureBox1.Image = e.Image
    Else If e.FileName <> Nothing And File.Exists(e.FileName) Then
        Me.pictureBox1.Image = Image.FromFile(e.FileName)
    End If
End Sub

Example

Remarks

All pending image acquisitions can be cancelled by setting the CancelPending property of the AcquireEventArgs to true.

To transfer the returned Bitmap to an AtalaImage when integrating with DotImage, use the AtalaImage.FromBitmap method.

When scanning multiple pages at once, this method can be used to compose a multipage image by invoking the Images.Add method of the Workspace object in DotImage.

Requirements

Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also