[SerializableAttribute ()]
公共文摘类BarcodeReadOptions:BarcodeOptions
< TypeConverterAttribute () >
< SerializableAttribute () >
公共mustlinherit类BarcodeReadOptions
继承了BarcodeOptions
实现了System.ICloneable
@接口LTBarcodeReadOptions: LTBarcodeOptions
公共文摘类BarcodeReadOptions扩展BarcodeOptions
[TypeConverterAttribute ()]
[SerializableAttribute ()]
公共ref类BarcodeReadOptions文摘:公共BarcodeOptions,System.ICloneable
的BarcodeReader类包含多个方法从图像读取一个或多个条形码(参考BarcodeReader.ReadBarcode和BarcodeReader.ReadBarcodes方法)。对于每个条码发现,BarcodeReader将返回的一个实例吗BarcodeData条形码中填充数据。
的BarcodeReadOptions类及其派生类型用于控制选项时使用阅读使用LEADTOOLS条形码。你可以设置的选项在两个方面:
的BarcodeReader类包含默认选项为每个条码符号(或一组常见的象征学)。这些选项可以检索使用BarcodeReader.GetDefaultOptions方法通过感兴趣的象征。你可以改变返回的成员BarcodeReadOptions(或铸造后适当的派生类)。
您还可以创建派生的一个实例BarcodeReadOptions类和直接使用它BarcodeReader.ReadBarcode和BarcodeReader.ReadBarcodes方法接受一个或数组作为输入参数的选项。
的BarcodeReadOptions包含以下成员和特点:
成员 | 描述 |
---|---|
BarcodeReadOptions.ForeColor | 控制条形码前景颜色(颜色的酒吧或符号)时使用从彩色图像读取条形码。 |
BarcodeReadOptions.BackColor | 控制条码背景颜色(颜色空间)时使用从彩色图像读取条形码。 |
BarcodeReadOptions.Load和BarcodeReadOptions.Save | 可以用来保存或加载选项/从一个XML文件或流。 |
BarcodeReadOptions.GetSupportedSymbologies和BarcodeReadOptions.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符号学。 |
这个例子中设置默认条形码搜索选项的所有支持的象征学“水平和垂直”然后从旋转图像读取条形码。
使用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
结束函数
公共NotInheritable类LEAD_VARS
公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”
结束类
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等
谢谢你的反馈!
请填写表单重新开始一个新的聊天。
所有代理目前离线。
聊天时间:
周一-周五
早上8:30 - 6点
联系我们请填写这张表格,我们将通过电子邮件联系你。