原創|其它|編輯:郝浩|2012-12-28 13:28:13.000|閱讀 387 次
概述:使用GdPicture.NET從TWAIN設備中獲取圖像并讀取條碼的具體示例代碼,注意:圖形掃描工具在使用前需要插入條形碼識別引擎,該功能才會實現。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
本教程將要給出使用 GdPicture.NET 從TWAIN設備中獲取圖像并讀取條碼的具體示例代碼,但是注意:圖形掃描工具在使用前需要插入條形碼識別引擎,該功能才會實現。
示例代碼如下:
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 oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial license KEY 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 MsgBox(Str(BarCodeCount) + " barcode have been found in the scanned image") For i As Integer = 1 To BarCodeCount MsgBox("Type of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetType(i).ToString) MsgBox("Value of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetValue(i)) Next Call oGdPictureImaging.ReleaseGdPictureImage(ImageID) End If Else MsgBox("Error: Barcode detection is not available on this scanner") End If Call oGdPictureImaging.TwainCloseSource() MsgBox("Done !") Else MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString) End If End Sub
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網