Image Viewer CP ActiveX Control

BarCodeReadByZone

 

Set specific zone for 1D and 2D barcode recognizing.

Public Function BarCodeReadByZone( _
   ByVal iLeft  As long, _
   ByVal iTop  As long, _
   ByVal iWidth  As long, _
   ByVal iHeight  As long
) As Integer

 If you want to scan faster, you may set BarCodeReadScanMultiple, BarCodeReadScanWithoutRotation, BarCodeReadScan45Rotation, BarCodeReadScan45CouterRotation,  BarCodeReadScanAccuracy, BarCodeReadCustomRotation properties.

e.g. If you set BarCodeReadScanWithoutRotation = True, BarCodeReadScan45Rotation =True, BarCodeReadScan45CouterRotation =True
It mean first it will load the image without any rotation, then scan the barcode, next rotate the image to 45 degree, scan the barcode , finally rotate the image with counter clockwise and scan the barcode.
If your image contain one barcode and the barcode have not any rotation, you may set the following properties, it will scan faster.
 mageViewer1.BarCodeReadScanMultiple = False
ImageViewer1.BarCodeReadScanWithoutRotation = True
ImageViewer1.BarCodeReadScan45Rotation =False
ImageViewer1.BarCodeReadScan45CouterRotation =False
ImageViewer1.BarCodeReadScanAccuracy = False
ImageViewer1.BarCodeReadCustomRotation=0

Parameter

iLeft
Specifies the logical left-coordinate of the starting point of the rectangle.

iTop
Specifies the logical top-coordinate of the starting point of the rectangle.

iWidth
the width of rectangle.

iHeight
the height of rectangle.


Return Value

Return the number of barcode detected, if return value smaller than 0, it mean failed.

Example

   

Visual Basic Syntax
ImageViewer1.BarCodeReadScanMultiple = True
ImageViewer1.BarCodeReadScanWithoutRotation = True
ImageViewer1.BarCodeReadScan45Rotation =True
ImageViewer1.BarCodeReadScan45CouterRotation =True
ImageViewer1.BarCodeReadScanAccuracy = True
ImageViewer1.BarCodeReadCustomRotation=0
ImageViewer1.LoadMultiPage "c:\source.tif",0
ibarcodeCount = Me.ImageViewer1.BarCodeReadByZone(0,0,100,100)
str1 = "Total " + Str(ibarcodeCount) + " BarCode detected" + Chr(13) + Chr(10)

For i = 0 To ibarcodeCount - 1
strTmp = Me.ImageViewer1.BarCodeGetType(i) + " score:" + Str(Me.ImageViewer1.BarCodeGetScore(i)) + " value:" + Me.ImageViewer1.BarCodeGetValue(i)
str1 = str1 + Chr(13) + Chr(10) + strTmp
Next

MsgBox str1