原創|使用教程|編輯:龔雪|2015-12-10 16:31:36.000|閱讀 373 次
概述:本文將對GdPicture.NET中一維條碼的繪制進行簡單介紹,代碼可供參考。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
GdPicture.NET是一款功能全面且可無限分發的文檔圖像處理的一體化工具包。其一體化主要包含:PDF、圖像處理、文檔影像、掃描、條形碼、打印、OCR、表單處理、注釋等。本文將簡單介紹如何用GdPicture.NET實現一維條碼的繪制。
'假設GdPicture.NET已安裝和解鎖 '假設創建并繪制了GdViewer對象GdViewer1 Dim oGdPictureImaging As New GdPictureImaging '加載圖片 Dim imageId As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("C:\\Image.tif") '檢驗圖片是否被正確加載 If imageId = 0 Then MessageBox.Show("Image Could Not Be Loaded! " + oGdPictureImaging.GetStat().ToString()) Else '在GdViewer中顯示圖像 GdViewer1.DisplayFromGdPictureImage(imageId) End If ''' <summary> ''' 在GdViewer的Mouse UP 事件中,繪制1D條碼 ''' </summary> ''' <param name=" eventSender ">對象 ''' <param name=" eventArgs ">數據 ''' <remarks> ''' 如果GdViewer沒有矩形,則這個事件將什么都不會完成 ''' </remarks> Public Sub Draw_Barcode(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles GdViewer1.MouseUp '初始化變量保存矩形位置 Dim leftArea As Integer, topArea As Integer, widthArea As Integer, heightArea As Integer '檢查GdViewer中是否畫出矩形 If GdViewer1.IsRect() Then '獲取位置 Call GdViewer1.GetRectCoordinatesOnDocument(leftArea, topArea, widthArea, heightArea) Dim barcodeType As Barcode1DWriterType = Barcode1DWriterType.Barcode1DWriterCode128 '繪制1D條碼 Dim status As GdPictureStatus = oGdPictureImaging.Barcode1DWrite(imageId, barcodeType, "GdPicture 1D Barcode", leftArea, topArea, widthArea, heightArea, oGdPictureImaging.ARGB(255, 0, 0, 0)) If status <> GdPictureStatus.OK Then MessageBox.Show("ERROR: " + status.ToString()) Else '重繪該圖像 GdViewer1.Redraw() End If End If End Sub
本文譯自
購買最新正版授權!""
慧都年終盛典火爆開啟,一年僅一次的最強促銷,破冰鉅惠不容錯過!!優惠詳情點擊查看>>
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn