有用过科本条形码的么?DPI 像素问题

yanquenzwl 2011-04-14 09:50:18
最近做个画图稿的项目,图稿上要绘制条形码,于是用到了科本条形码1.5的版本,可是发现个问题,我的图片的要很高清的
DPI在800--1200左右,科本的条形码怎么设置生成的图片的像素呢?

BarcodeControl barcode = new BarcodeControl();
barcode.BarcodeType = BarcodeType.EAN13;
barcode.Data = "123456";
barcode.CopyRight = "";
barcode.HorizontalAlignment = BarcodeHorizontalAlignment.Center;//对齐方式
barcode.StretchText = true;
RectangleF f = GetRectangle(PageCount);
f.Y += 46;
f.Height = 10;
f.Width = 25;
MemoryStream stream = new MemoryStream();
//中间传参数宽为1 高为50图像就正常但分辨率太低 如果宽和高调大 图像就不成比例了
//结果就看不到条形码下面的数字了
barcode.MakeImage(System.Drawing.Imaging.ImageFormat.Jpeg, 2, 130, true, false, null, stream);

System.Drawing.Image barcodeImage = System.Drawing.Image.FromStream(stream);

g.DrawImage(barcodeImage, f);
stream.Dispose();//释放资源
...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanquenzwl 2011-04-15
  • 打赏
  • 举报
回复

BarcodeControl barcode = new BarcodeControl();
barcode.BarcodeType = BarcodeType.EAN13;
barcode.Data = "012345678912";
barcode.CopyRight = "";
barcode.HorizontalAlignment = BarcodeHorizontalAlignment.Center;//对齐方式
barcode.StretchText = true;
barcode.Font = new Font("Arial", 180f, FontStyle.Regular);

MemoryStream stream = new MemoryStream();
barcode.MakeImage(System.Drawing.Imaging.ImageFormat.Jpeg, 25, 1500, true, false, null, stream);

System.Drawing.Image barcodeImage = System.Drawing.Image.FromStream(stream);
g.PageUnit = GraphicsUnit.Millimeter;
g.DrawImage(barcodeImage, f);
stream.Dispose();//释放资源

找到了解决方案 原来是字体没有设

4,816

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧