世俱杯 2025

条码控件Aspose.BarCode教程:控制 Barcode-39 中的宽窄比

翻译|使用教程|编辑:吉炜炜|2025-01-21 13:50:30.607|阅读 30 次

概述:控制 Barcode-39 中的宽窄比是条形码配置的一个重要方面。这篇教程将指导您如何使用 Aspose.BarCode for .NET 控制 Barcode-39 中的宽窄比。

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>

相关链接:


概述

控制 Barcode-39 中的宽窄比是条形码配置的一个重要方面。它确保条形码的可读性和准确性,这对从零售到物流等各个行业都至关重要。Aspose.BarCode for .NET是一个功能强大的工具,允许开发人员轻松管理此比率,从而为条形码创建提供灵活性和精确度。这篇教程将指导您如何使用 Aspose.BarCode for .NET 控制 Barcode-39 中的宽窄比。

Aspose.BarCode 最新试用下载

库安装

首先,从此链接安装Aspose.BarCode for .NET。使用以下命令进行安装:

Install-Package Aspose.BarCode

Aspose.BarCode for .NET 因其易于集成、灵活性和高级定制选项而脱颖而出,使其成为控制 Barcode-39 中宽窄比的理想选择。

带有分步指南的代码片段

要使用 Aspose.BarCode for .NET 控制 Barcode-39 中的宽窄比,请按照以下步骤操作。

  1. 创建BarcodeGenerator的实例。
  2. 使用数值设置Pixels属性。
  3. 通过定义WideNarrowRatio的值将宽/窄比设置为 2 。
  4. Save方法将把条形码保存在磁盘上。

以下代码示例演示了如何以编程方式控制 Barcode-39 的宽窄比:

using Aspose.BarCode.Generation;

string path = "/Desktop/";
System.Console.WriteLine("OneCSCode93:");
// Create an instance of BarcodeGenerator. 
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code39FullASCII, "ASPOSE");
// Set the Pixels property with a numeric value; 
gen.Parameters.Barcode.XDimension.Pixels = 2;
// Set Wide/Narrow Ratio to 2 by defining the value of WideNarrowRatio.
gen.Parameters.Barcode.WideNarrowRatio = 2;
// The Save method will save the barcode on the disk.
gen.Save($"{path}WideNarrow2Code39.png", BarCodeImageFormat.Png);
//set Wide/Narrow Ratio to 5.
gen.Parameters.Barcode.WideNarrowRatio = 5;
// Invoke the Save method to save the barcode on the disk.
gen.Save($"{path}WideNarrow5Code39.png", BarCodeImageFormat.Png);

您可以在下图中看到输出:

定义-barcode39


结论

现在,您可以通过编程控制 Barcode-39 中的宽窄比。使用 Aspose.BarCode for .NET,您可以轻松管理此比例,确保条形码的可读性和准确性。

————————————————————————————————————————————

欢迎下载|体验更多Aspose产品

点此获取更多Aspose产品信息 或 加入Aspose技术交流2群(666790229

aspose下载


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@dpuzeg.cn

文章转载自:慧都网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
相关产品
Aspose.BarCode

可在任何平台上生成和识别条形码。

Aspose.Barcode for Reporting Services

Aspose.BarCode for Reporting Services 是最全面的MS SQL Server 2000 、2005和2008 Reporting Services 条形码显示解决方案。

Aspose.BarCode for JasperReports

专业的条形码生成和识别组件,帮助开发者在JasperReports中显示高质量的条形码标签。

Aspose.BarCode for SharePoint

Aspose.BarCode for SharePoint提供的功能:让您在Microsoft SharePoint列表中插入条形码。

Aspose.BarCode for C++

创建或识别1D和2D条形码类型以及将生成的条形码导出为C ++应用程序中的多种图像格式。

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP