GdPicture.NET Reference Guide
TwainBarCodeGetXPos Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : TwainBarCodeGetXPos Method
The barcode number. Must be value between 1 and the number of detected barcodes.
Returns the X coordinate of a bar code found on the last acquired image.
Syntax
'Declaration
 
Public Function TwainBarCodeGetXPos( _
   ByVal BarCodeNo As Integer _
) As Integer
public int TwainBarCodeGetXPos( 
   int BarCodeNo
)
public function TwainBarCodeGetXPos( 
    BarCodeNo: Integer
): Integer; 
public function TwainBarCodeGetXPos( 
   BarCodeNo : int
) : int;
public: int TwainBarCodeGetXPos( 
   int BarCodeNo
) 
public:
int TwainBarCodeGetXPos( 
   int BarCodeNo
) 

Parameters

BarCodeNo
The barcode number. Must be value between 1 and the number of detected barcodes.

Return Value

The barcode X coordinate. Return -1 if current source does not support X coordinate reporting.
Remarks
Before using this method make sure that the barcode detection was enabled by the TwainSetBarcodeDetection() method. Use the TwainBarCodeGetCount() method to determine how many barcodes have been detected on the last acquired image.
Example
Acquire single image and detect its barcodes
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
Dim ImageID As Integer
Dim oGdPictureImaging As New GdPicture.GdPictureImaging
If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
   If oGdPictureImaging.TwainIsBarcodeDetectionAvailable Then
      oGdPictureImaging.TwainSetBarcodeDetection(True)
      ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
      If imageId <> 0 Then
         Dim BarCodeCount As Integer = oGdPictureImaging.TwainBarCodeGetCount
         MessageBox.show(Str(BarCodeCount) + " barcode has been found in the scanned image")
         For i As Integer = 1 To BarCodeCount
            MessageBox.show("Type of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetType(i).ToString)
            MessageBox.show("Value of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetValue(i))
         Next
         oGdPictureImaging.ReleaseGdPictureImage(ImageID)
      End If
   Else
      MessageBox.show("Error: Barcode detection is not available on this scanner")
   End If
   oGdPictureImaging.TwainCloseSource()
   MessageBox.show("Done !")
Else
   MessageBox.show("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
End If
End Sub
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
TwainIsBarcodeDetectionAvailable Method
TwainIsBarcodeDetectionEnabled Method
TwainSetBarcodeDetection Method
TwainBarCodeGetCount Method