将图像添加到datagridview单元格 [英] add image to datagridview cell

查看:125
本文介绍了将图像添加到datagridview单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用VB.Net Windows应用程序



我有一个带有两列的datagridview。 1-文字和2-图像。

我在资源中添加了一个图像someimage.png,在图像列表中添加了相同的图像。



我在运行时向datagridview添加新项目,图像显示不显示。



 ' 使用imagelist添加图像 
dgv.AddItem( sometext,ImageList1.Images( 0 ))





 ' 使用资源添加图像 
dgv.AddItem( sometext,My.Resources.sometext)





i也尝试

  Dim  _image 作为 位图( DirectCast (我的。 Resources.ResourceManager.GetObject(  sometext),System.Drawing.Bitmap))

dgv.AddItem( sometext,_ image)





上述以上都没有工作..

请帮助

解决方案

参见这个 [ ^ ]。它可能对你有帮助。


你确定 this [ ^ ] ??



-KR

Hi,

I am working on VB.Net Windows Application

I have a datagridview with two column. 1- Text and 2- Image.
I have add a image "someimage.png" in resources and same in imagelist.

when i add new items at runtime to datagridview the image dows not show.

'adding the image with imagelist
dgv.AddItem("sometext", ImageList1.Images(0))



'adding the image with resources
dgv.AddItem("sometext", My.Resources.sometext)



i have also try

Dim _image As New Bitmap(DirectCast(My.Resources.ResourceManager.GetObject("sometext"), System.Drawing.Bitmap))

dgv.AddItem("sometext", _image)



none of above are working..
please help

解决方案

See this[^]. It may help you.


And you sure about this[^] ??

-KR


这篇关于将图像添加到datagridview单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆