pictureBox如何显示资源中的图片

lirenedu 2011-01-23 11:41:31
pictureBox如何显示资源中的图片,以及如何返回当前pictureBox所加载(资源中)图像的名称。

要vb.net语法的,找了以前的贴子是C#及vc的语法,自己偿试改为vb.net的但都不成功。
...全文
588 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyerwing 2011-01-26
  • 打赏
  • 举报
回复
picturebox1.image=resource1.aimg;
大概就这样子了
大飞飞虫 2011-01-26
  • 打赏
  • 举报
回复
你自己给pictureBox设张图片,然后到 designer.cs 文件里去找,人家M$怎么用的
兔子-顾问 2011-01-26
  • 打赏
  • 举报
回复
这样访问资源
PictureBox1.Image = My.Resources.图片
xingyuebuyu 2011-01-24
  • 打赏
  • 举报
回复
        Dim thise As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
''获取所有资源文件的全名称
Dim strNames() As String = thise.GetManifestResourceNames()
Dim filename As String = ""
''假设是把本地的1.jpg设为资源文件,
For Each name As String In strNames
If name.ToLower.IndexOf("1.jpg") > -1 Then
filename = name
Exit For
End If
Next

If String.IsNullOrEmpty(filename) = False Then
Dim sr As System.IO.Stream = thise.GetManifestResourceStream(filename)
Me.pictureBox1.Image = Image.FromStream(sr)
End If
xixihaha_2011_098 2011-01-23
  • 打赏
  • 举报
回复
把图片放到imagelist中,然后通过imagelist的序号,显示到pictruebox 中就可以了呀
lirenedu 2011-01-23
  • 打赏
  • 举报
回复
Dim file As System.IO.Stream = thise.GetManifestResourceStream("")

括号中是空的吗?运行出错。

我偿试了在括号中写上资源中的文件名称,同样出错。


Global.实例后没有properties属性
wuyq11 2011-01-23
  • 打赏
  • 举报
回复
Dim thise As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Dim file As System.IO.Stream = thise.GetManifestResourceStream("")
Me.pictureBox1.Image = Image.FromStream(file)


ImageList.Images.Add(Global.实例.Properties.Resources.a)
ImageList.Images.Add(Global.实例.Properties.Resources.b)
pictureBox1.Image = ImageList.Images(1)

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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