Foxtable(狐表)用户栏目专家坐堂 → [求助]【条形码】能保存矢量图吗?


  共有2263人关注过本帖树形打印复制链接

主题:[求助]【条形码】能保存矢量图吗?

帅哥哟,离线,有人找我吗?
Hyphen
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/6/7 8:34:00 [显示全部帖子]

试试
Dim BarCode1 As WinForm.BarCode = e.Form.Controls("BarCode1")
Dim bmp = New Bitmap(BarCode1.GetImage())
Dim gs = Graphics.FromImage(bmp)
Dim mf = New Imaging.Metafile("D:\005.wmf", gs.GetHdc())
Dim g = Graphics.FromImage(mf)
g.DrawImageUnscaled(bmp, 0, 0)
g.Save()
g.Dispose()
mf.Dispose()

 回到顶部
帅哥哟,离线,有人找我吗?
Hyphen
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/6/7 14:30:00 [显示全部帖子]

vs帮助说.NET Framework 的 GDI+ 组件没有可用来将文件另存为 .wmf 或 .emf 文件的编码器,实际保存的是png格式,可能要第三方的编码器才行,比如Adobe Illustrator SDKs:http://www.adobe.com/devnet/illustrator/sdk.html
或者提高一下图像质量

Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = "010501301"
Bar.BarRatio = 0.8
Bar.BarHeight = 8
Bar.DisplayCode = False
'bar.SaveImage("c:\测试条形码.jpg",600)

Dim bmp = New Bitmap(bar.GetImage())
Dim gs = Graphics.FromImage(bmp)
Dim mf = New Imaging.Metafile("F:\0051.wmf", gs.GetHdc())
Dim g = Graphics.FromImage(mf)
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
g.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImageUnscaled(bmp, 0, 0)
g.Save()
g.Dispose()

 回到顶部