从datagridview检索图像 [英] retrieving image from datagridview

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

问题描述

您好先生,

我正在尝试从datagridview中检索图片框中的图片。

请建议一个代码。谢谢你

< pre lang =cs> string img = dataGridView1.Rows [i] .Cells [ 20 ]。值;
byte [] imagebyte =( byte [])img.ExecuteScalar();
MemoryStream mr = new MemoryStream(imagebyte);
mr.Seek( 0 ,SeekOrigin.Begin);
t.pictureBox1.Image = new 位图(mr);

解决方案

您好,



试试这个..

在DataGridView中使用鼠标点击将图像插入到图片框中 [ ^ ]



thanks


为什么你要尝试使用上面给出的代码,它可以简单地完成..

首先告诉我,你使用C#??回复

Hello Sir,
I am trying to retrieve image in a picturebox from datagridview.
please suggest a code.thank you

string img = dataGridView1.Rows[i].Cells[20].Value;
           byte[] imagebyte = (byte[])img.ExecuteScalar();
           MemoryStream mr = new MemoryStream(imagebyte);
           mr.Seek(0, SeekOrigin.Begin);
           t.pictureBox1.Image = new Bitmap(mr);

解决方案

Hello,

try this..
Inserting Image into picturebox with mouseclick in DataGridView[^]

thanks


why you are trying to use such code which you have give above, it can be done simply..
first tell me, are u using C# ?? reply


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

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