This event is generated just before an image is scanned with the scan device.
[Visual Basic]   imagekitcontrolname_BeforeScan(ByVal Width As Long, ByVal Height As Long, ByVal ImageCount As Long)
[Visual C++]     OnBeforeScanimagekitcontrolname(long Width, long Height, long ImageCount)
[VB.NET]   imagekitcontrolname_BeforeScan(ByVal sender As System.Object, ByVal e As AxImageKit10(A)Lib.IImageKitEvents_BeforeScanEvent)
[C#.NET]   imagekitcontrolname_BeforeScan(object sender, AxImageKit10(A)Lib.IImageKitEvents_BeforeScanEvent e)

* AxImageKit10ALib refers to the ANSI version, AxImageKit10Lib refers to the Unicode version.

Parameters

Name Explanation
Width The width of the image that will be transferred in pixels
Height The height of the image that will be transferred in pixels
ImageCount The image count. For a single page image file, this will always be 1. When scanning a multi-page image file, this will tell you which page of the multi-page file is about to be scanned.

* The second parameter in VB.NET/C#.NET is e and it contains the DibHandle and other arguments. (the first letter is lower case)

Explanation

Within this event it is possible to retrieve information about the actual image data that is being tranferred by referencing such properties as Scan.XResolution, Scan.YResolution, Scan.BitDepth, Scan.PixelType, Scan.Compression.

When the Scan.PaperSize property is set to 1000 (ikScanUndefinedSize) and above, the Width and Height parameters may return values of -1. It is also possible that the Width and Height parameters may return values bigger than the actual document plate.

When the Scan.PixelType property is set to 1000 (ikScanPixelAutomation), the retrieved BitDepth and PixelType may be different from the actual image.

To cancel the scan set the Scan.Cancel property to True within this event.

 

Regarding the Scan.XResolution and Scan.YResolution properties:

Although the TWAIN specifications allow scan units to be inches or centimeters, depending on the datasource (scan device) the scan units settings are ignored and DPI is used. Furthermore, if scan units are set to pixels, there are cases where the datasource will return a value of 1 as these resolution properties.

 

Regarding the Scan.BitDepth property:

If scanning in 12 or 14 bit grayscale, the Scan.BitDepth property will have a value of 16. If scanning in 36 or 42 bit color, the Scan.BitDepth property will have a value of 48.

Regarding the Scan.Compression property

This is used when file transfer or memory transfer is used. (For native transfer, this is irrelevant)

 

The ImageKit10 ActiveX is a product created by Newtone Corporation