【发布时间】:2021-02-27 09:50:09
【问题描述】:
我将图像存储到属性>资源,但是当我在我的代码中调用它时,我得到了错误
'bitmap'的值类型不能转换为'string'
oSheet.Shapes.AddPicture(My.Resources.123_LOGO,
Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoCTrue, 0, 0, 940, 120)
你认为问题是什么? 我已经有这个了,但它不工作
Dim imge As New System.Drawing.Bitmap(700, 1500)
Dim g As Graphics = Graphics.FromImage(imge)
oSheet.Shapes.AddPicture(g,
Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoCTrue, 0, 0, 940, 120)
【问题讨论】:
-
Shapes.AddPicture()需要文件的路径(字符串)。你正在传递一个位图。 -
我该怎么做?我已经尝试过这个 `Dim Image As String = Convert.ToString(My.Resources.Capture)`,但我很难
-
为什么不使用
imge.save("temp.bmp")保存位图,然后使用Shapes.AddPicture("temp.bmp")将其读取为文件,然后删除temp.bmp -
你能举个例子吗?
标签: vb.net