←选择平台

BarcodeReadOptions类

总结
基类的所有条码阅读选项。
语法
c#
VB
objective - c
c++
Java
[SerializableAttribute ()]公共文摘BarcodeReadOptions:BarcodeOptions
< TypeConverterAttribute () >< SerializableAttribute () >公共mustlinheritBarcodeReadOptions继承了BarcodeOptions实现了System.ICloneable
@接口LTBarcodeReadOptions: LTBarcodeOptions
公共文摘BarcodeReadOptions扩展BarcodeOptions
[TypeConverterAttribute ()][SerializableAttribute ()]公共ref类BarcodeReadOptions文摘:公共BarcodeOptions,System.ICloneable
讲话

BarcodeReader类包含多个方法从图像读取一个或多个条形码(参考BarcodeReader.ReadBarcodeBarcodeReader.ReadBarcodes方法)。对于每个条码发现,BarcodeReader将返回的一个实例吗BarcodeData条形码中填充数据。

BarcodeReadOptions类及其派生类型用于控制选项时使用阅读使用LEADTOOLS条形码。你可以设置的选项在两个方面:

BarcodeReader类包含默认选项为每个条码符号(或一组常见的象征学)。这些选项可以检索使用BarcodeReader.GetDefaultOptions方法通过感兴趣的象征。你可以改变返回的成员BarcodeReadOptions(或铸造后适当的派生类)。

您还可以创建派生的一个实例BarcodeReadOptions类和直接使用它BarcodeReader.ReadBarcodeBarcodeReader.ReadBarcodes方法接受一个或数组作为输入参数的选项。

BarcodeReadOptions包含以下成员和特点:

成员 描述
BarcodeReadOptions.ForeColor

控制条形码前景颜色(颜色的酒吧或符号)时使用从彩色图像读取条形码。

BarcodeReadOptions.BackColor

控制条码背景颜色(颜色空间)时使用从彩色图像读取条形码。

BarcodeReadOptions.LoadBarcodeReadOptions.Save

可以用来保存或加载选项/从一个XML文件或流。

BarcodeReadOptions.GetSupportedSymbologiesBarcodeReadOptions.IsSupportedSymbology

可以用来获取所有的吗BarcodeSymbology的支持BarcodeReadOptions类型或检查时,支持一个特定的象征。

BarcodeReadOptions是一个抽象类,不能直接创建,而不是创建一个派生类的:

读选项课 描述
OneDBarcodeReadOptions

标准一维线性条形码选项。阅读时使用下列象征学:EAN13, EAN8, UPCA, UPCE, Code3Of9, Code128, CodeInterleaved2Of5, Codabar, UCCEAN128, Code93, EANEXT5, EANEXT2, MSI, Code11, CodeStandard2Of5, GS1Databar, GS1DatabarLimited或GS1DatabarExpanded

GS1DatabarStackedBarcodeReadOptions

GS1 Databar堆叠条形码选项。阅读时使用GS1DatabarStacked或GS1DatabarExpandedStacked象征学

FourStateBarcodeReadOptions

4-State条形码选项。阅读时使用AustralianPost4State RoyalMail4State或USPS4State象征学

PostNetPlanetBarcodeReadOptions

POSTNET /行星条形码选项。阅读时使用PostNet或行星象征学

PatchCodeBarcodeReadOptions

补丁代码条形码选项。阅读时使用PatchCode符号学。

DatamatrixBarcodeReadOptions

Datamatrix条形码选项。阅读时使用Datamatrix符号学。

MicroPDF417BarcodeReadOptions

微PDF417条码的选择。阅读时使用MicroPDF417符号学。

PDF417BarcodeReadOptions

PDF417条码的选择。阅读时使用PDF417符号学。

QRBarcodeReadOptions

QR条形码选项。阅读时使用QR符号学。

AztecBarcodeReadOptions

阿兹特克条形码选项。阅读时使用的阿兹特克的象征。

MaxiBarcodeReadOptions

马克西条形码选项。阅读时使用马克西符号学。

MicroQRBarcodeReadOptions

MicroQR条形码选项。阅读时使用MicroQR符号学。

PharmaCodeBarcodeReadOptions

PharmaCode条形码选项。阅读时使用PharmaCode符号学。

例子

这个例子中设置默认条形码搜索选项的所有支持的象征学“水平和垂直”然后从旋转图像读取条形码。

c#
VB
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Barcode;使用Leadtools.ImageProcessing;公共无效BarcodeReadOptions_Example (){字符串imageFileName = Path.Combine (LEAD_VARS.ImagesDir,“Barcode1.tif”);/ /创建一个条码引擎BarcodeEngine引擎=BarcodeEngine ();/ /得到条形码阅读器的实例BarcodeReader读者= engine.Reader;/ /加载图像使用(RasterCodecs编解码器=RasterCodecs ()){使用(RasterImage图像=编解码器。加载(imageFileName 0 CodecsLoadByteOrder。BgrOrGray 1,1)){/ /旋转图像,到90年,所以默认的阅读水平条形码将不会工作Console.WriteLine (“90度旋转图像”);RotateCommand旋转=RotateCommandFlags RotateCommand (90 * 100。调整,RasterColor.FromKnownColor (RasterKnownColor.White));rotate.Run(图片);/ /读取所有的条形码图像使用默认选项Console.WriteLine (“阅读条形码使用默认选项”);BarcodeData[]条形码=读者。LeadRect ReadBarcodes(图片。空的,0,,);/ /显示条形码发现的数量,应该是0因为默认搜索方向是水平的Console.WriteLine (“发现了{0}条形码”,barcodes.Length);/ /读取条形码横向和纵向现在创建选项BarcodeReadOptions[]选项= GetHorizontalAndVerticalReadBarcodeOptions(读者);/ /再次阅读Console.WriteLine (“阅读条形码使用新选项”);条形码=读者。LeadRect ReadBarcodes(图片。空的,0,、选择);/ /显示条形码发现的数量,现在都应该阅读Console.WriteLine (“发现了{0}条形码”,barcodes.Length);}}}私人静态BarcodeReadOptions [] GetHorizontalAndVerticalReadBarcodeOptions (BarcodeReader读者){/ /默认情况下,选择阅读水平条形码,创建一个数组选择垂直条形码阅读的能力/ /注意,我们克隆默认选项在读者不会改变最初的选择OneDBarcodeReadOptions oneDReadOptions = reader.GetDefaultOptions (BarcodeSymbology.UPCA) .Clone ()作为OneDBarcodeReadOptions;oneDReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;FourStateBarcodeReadOptions fourStateReadOptions = reader.GetDefaultOptions (BarcodeSymbology.USPS4State) .Clone ()作为FourStateBarcodeReadOptions;fourStateReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;PostNetPlanetBarcodeReadOptions postNetPlanetReadOptions = reader.GetDefaultOptions (BarcodeSymbology.PostNet) .Clone ()作为PostNetPlanetBarcodeReadOptions;postNetPlanetReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;GS1DatabarStackedBarcodeReadOptions gs1StackedReadOptions = reader.GetDefaultOptions (BarcodeSymbology.GS1DatabarStacked) .Clone ()作为GS1DatabarStackedBarcodeReadOptions;gs1StackedReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;PatchCodeBarcodeReadOptions patchCodeReadOptions = reader.GetDefaultOptions (BarcodeSymbology.PatchCode) .Clone ()作为PatchCodeBarcodeReadOptions;patchCodeReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;PDF417BarcodeReadOptions pdf417ReadOptions = reader.GetDefaultOptions (BarcodeSymbology.PDF417) .Clone ()作为PDF417BarcodeReadOptions;pdf417ReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;MicroPDF417BarcodeReadOptions microPdf417ReadOptions = reader.GetDefaultOptions (BarcodeSymbology.MicroPDF417) .Clone ()作为MicroPDF417BarcodeReadOptions;microPdf417ReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical;/ /即使这个数组将不会包含所有选项,它足以阅读所有条形码,因为ReadBarcodes我们将使用的版本/ /将使用默认选项如果一个覆盖没有通过BarcodeReadOptions [] readOptions ={oneDReadOptions、fourStateReadOptions postNetPlanetReadOptions、gs1StackedReadOptions patchCodeReadOptions, pdf417ReadOptions microPdf417ReadOptions};返回readOptions;}静态LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;}
进口Leadtools进口Leadtools.Codecs进口Leadtools.Barcode进口Leadtools.ImageProcessing公共BarcodeReadOptions_Example ()昏暗的imageFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Barcode1.tif”)“创建一个条码引擎昏暗的引擎作为BarcodeEngine ()“条形码阅读器实例昏暗的读者作为BarcodeReader = engine.Reader“加载图片使用编解码器作为RasterCodecs ()使用图像作为RasterImage =编解码器。加载(imageFileName 0 CodecsLoadByteOrder。BgrOrGray, 1, 1)的旋转图像90,所以默认的阅读期待视野条形码将不会工作Console.WriteLine (“90度旋转图像”)昏暗的旋转作为RotateCommandFlags RotateCommand (90 * 100。调整,RasterColor.FromKnownColor (RasterKnownColor.White))rotate.Run(图片)“阅读所有的条形码图像使用默认选项Console.WriteLine (“阅读条形码使用默认选项”)昏暗的条形码()作为BarcodeData =读者。LeadRect ReadBarcodes(图片。空的,0,没有什么,没有什么)显示条形码发现的数量,应该是0,因为默认搜索方向是水平的Console.WriteLine (“发现了{0}条形码”barcodes.Length)“现在创建选项来读取条形码横向和纵向昏暗的选择()作为BarcodeReadOptions = GetHorizontalAndVerticalReadBarcodeOptions(读者)“再读Console.WriteLine (“阅读条形码使用新选项”)条形码=读者。LeadRect ReadBarcodes(图片。空的,0,没有什么选项)“显示条形码发现的数量,现在都应该阅读Console.WriteLine (“发现了{0}条形码”barcodes.Length)结束使用结束使用结束私人共享函数GetHorizontalAndVerticalReadBarcodeOptions (按值传递读者作为BarcodeReader)作为BarcodeReadOptions ()默认情况下,选择阅读水平条形码,创建一个数组的选项能够阅读垂直的条形码通知,我们克隆默认选项在读者所以我们不会改变最初的选择昏暗的oneDReadOptions作为OneDBarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.UPCA) .Clone (), OneDBarcodeReadOptions)oneDReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的fourStateReadOptions作为FourStateBarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.USPS4State) .Clone (), FourStateBarcodeReadOptions)fourStateReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的postNetPlanetReadOptions作为PostNetPlanetBarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.PostNet) .Clone (), PostNetPlanetBarcodeReadOptions)postNetPlanetReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的gs1StackedReadOptions作为GS1DatabarStackedBarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.GS1DatabarStacked) .Clone (), GS1DatabarStackedBarcodeReadOptions)gs1StackedReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的patchCodeReadOptions作为PatchCodeBarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.PatchCode) .Clone (), PatchCodeBarcodeReadOptions)patchCodeReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的pdf417ReadOptions作为PDF417BarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.PDF417) .Clone (), PDF417BarcodeReadOptions)pdf417ReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical昏暗的microPdf417ReadOptions作为MicroPDF417BarcodeReadOptions =DirectCast(reader.GetDefaultOptions (BarcodeSymbology.MicroPDF417) .Clone (), MicroPDF417BarcodeReadOptions)microPdf417ReadOptions。搜索Direction = BarcodeSearchDirection.HorizontalAndVertical尽管这个数组不会包含所有选项,它足以阅读所有条形码,因为ReadBarcodes我们将使用的版本将使用默认的选项如果一个重载没有通过昏暗的readOptions ()作为BarcodeReadOptions ={oneDReadOptions、fourStateReadOptions postNetPlanetReadOptions、gs1StackedReadOptions patchCodeReadOptions, pdf417ReadOptions microPdf417ReadOptions}返回readOptions结束函数公共NotInheritableLEAD_VARS公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”结束
需求

目标平台

Leadtools.Barcode作为sembly
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。