以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  二维码中插入一个Logo问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=124640)

--  作者:aza520
--  发布时间:2018/9/11 10:17:00
--  二维码中插入一个Logo问题
搜索了一段在QRcode中插入Logo的代码如下:
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = "测试:测试"
bar.SaveImage("d:\\test.wmf",300)
Dim imgback As image = getimage("d:\\test.wmf")
Dim bmp As new bitmap(imgback.width, imgback.height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(imgback, 0, 0, imgback.Width, imgback.Height)
Dim img = getimage("d:\\test.ico")
Dim w As Integer = (imgback.width-img.width) / 2
Dim h As Integer = (imgback.height-img.height) / 2
g.DrawImage(img, w, h, img.Width, img.Height)
bmp.Save("d:\\test05.jpg")
bmp.dispose

在窗口中增加一个BarCode控件(如下图),想在生成的二维码中插入一个Logo图标,Logo图标是一个ICO文件,路径为本机电脑:d:\\我的图标\\Logo图标.ico,请问老师,以上代码怎么改,写在哪个事件下。

图片点击可在新窗口打开查看此主题相关图片如下:2222.png
图片点击可在新窗口打开查看





--  作者:有点甜
--  发布时间:2018/9/11 10:42:00
--  

放一个图片picturebox控件,然后写代码,如

 

Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = "测试:测试"

Dim imgback As image = bar.GetImage
Dim bmp As new bitmap(imgback.width, imgback.height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(imgback, 0, 0, imgback.Width, imgback.Height)
Dim img = getimage("d:\\test.ico")
Dim w As Integer = (imgback.width-img.width) / 2
Dim h As Integer = (imgback.height-img.height) / 2
g.DrawImage(img, w, h, img.Width, img.Height)

e.Form.controls("picturebox1").image = bmp