我们如何在c#.net windows应用程序中的数据gridview列中显示图像? [英] How can we image display in data gridview column in c# .net windows application?

查看:81
本文介绍了我们如何在c#.net windows应用程序中的数据gridview列中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我在datagridview现有列中使用此代码显示图像,只在我的datagridview列中显示System.Drawing.Bitmap。 />
我的图像列数据类型是varchar(max)。



Hello,

I am using this code for display image in datagridview existing column, only "System.Drawing.Bitmap" displayed in my datagridview column.
My image column datatype is varchar(max).

foreach (DataGridViewRow row1 in dgvDisplayTiles.Rows)
            {
                string imgPath;
                imgPath= (Application.StartupPath + row1.Cells[3].Value.ToString());
                Image imageFloorTile = Image.FromFile(imgPath);
                if (imgPath != null)
                {
                    //img.Image=imgPath;
                  row1.Cells[3].Value = imageFloorTile;
                }
                else
                {
                    MessageBox.Show("Invalid Path");
                }
            }





我们如何在c#.net windows应用程序中的数据gridview列中显示图像?



请帮帮我。



提前致谢。



Ankit Agarwal

软件工程师



How can we image display in data gridview column in c# .net windows application?

Please help me.

Thanks in advance.

Ankit Agarwal
Software Engineer

推荐答案





这应该很简单:使用 DataGridViewImageColumn 作为列类型。



顺便说一句。随时掌握MSDN网站总是很好......例如 http:/ /msdn.microsoft.com/de-de/library/2ab8kd75(v=vs.110).aspx [ ^ ]


这篇关于我们如何在c#.net windows应用程序中的数据gridview列中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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