This event is generated after an image is scanned with the scan device.
Event Data
The event handler receives arguments of type AfterScanEventArgs.
Explanation
The AfterScanevent is generated after an image is scanned with the scan device. Information about the actual image data transfered in this event can be referenced through the AfterScanEventArgs arguments.
Regarding properties of the AfterScanEventArgs class:
This event is generated after an image is scanned with the scan device. When the Dispose argument is true, the scanned image data (Bitmap1 and Bitmap2) is disposed after this event fires so if you want to use this image data in any way, you must make a copy of the scanned image in the memory or save it in an image file. When the Dispose argument is false, the scanned image data (Bitmap1 and Bitmap2) is not disposed.
(1) When using native transfer or when using memory transfer without compression:
If the scanned image is 1, 4, 8, or 24 bits then the image is set in Bitmap1 and Bitmap2 will be null (Nothing in Visual Basic). If the scanned image is 12, 14, or 16 bit grayscale or 36, 42, or 48 bit color then the image will be set in Bitmap2 and the Bitmap2 image data will be converted to 8 bit grayscale or 24 bit color and that will be set in Bitmap1. In this case, if the Bitmap1 memory cannot be allocated it will be null (Nothing in Visual Basic)
(2) When using memory transfer with compression:
The scanned image is set into RawData. Both Bitmap1 and Bitmap2 will be null (Nothing in Visual Basic)(3) When using file transfer:
Both Bitmap1 and Bitmap2 will be null (Nothing in Visual Basic). The file will be saved in the location specified by FileName
When Scan.UserInterface property is set to Suppress and the Scan.Unit property is Pixel, there are cases in which the resolution of Bitmap1 and Bitmap2 will be 1. To cancel scanning set the Cancel property to True.
Example
The following code displays the image scanned.
[Visual Basic.NET] Private Sub ImageKit1_AfterScan(ByVal sender As Object, ByVal e As Newtone.ImageKit.AfterScanEventArgs) Handles ImageKit1.AfterScan If (e.Bitmap1 Is Nothing) Then Exit Sub If Not (ImageKit1.Image Is Nothing) Then ImageKit1.Image.Dispose() End If ImageKit1.Image = e.Bitmap1.Clone() ImageKit1.Display(Newtone.ImageKit.Win.DisplayMode.Stretch) End Sub [Visual C#.NET] private void imageKit1_AfterScan(object sender, Newtone.ImageKit.AfterScanEventArgs e) { if (e.Bitmap1 == null) return; if (imageKit1.Image != null) imageKit1.Image.Dispose(); imageKit1.Image = (Image)e.Bitmap1.Clone(); imageKit1.Display(Newtone.ImageKit.Win.DisplayMode.Stretch); }