繁体   English   中英

无法在C#中的数据中继器控件中的图片框中显示图像

[英]Can't display images in picturebox in data repeater control in C#

我无法在数据转发器控件的图片框中显示图像。 我的代码是:

cnn.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new System.Data.DataSet();
da.Fill(ds);
bi.DataSource = ds.Tables[0];
textBox1.DataBindings.Add("Text",bi,"Emri");
textBox2.DataBindings.Add("Text", bi, "Mbiemri");
Byte[] bfoto = (Byte[])(ds.Tables[0].Rows[0]["Foto"]);
MemoryStream ms = new MemoryStream(bfoto);
Bitmap bFoto = new Bitmap(ms);
pictureBox1.DataBindings.Add("image", bi, "Foto", true);

dataRepeater1.DataSource = bi;

是一个如何从位图设置图像属性的示例。

PictureBox pictureBox1 = new PictureBox();
// your code
Bitmap bFoto = new Bitmap(ms);
pictureBox1.Image = bFoto;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM