在行中动态添加图片框 [英] Add picture boxes dynamically in row

查看:81
本文介绍了在行中动态添加图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连续显示图像.为此,我试图动态添加图片框.图像位置存储在数据库中.我的代码是

I am trying to show images in a row..For this I am trying to add picture boxes dynamically. Image location is stored in databses. my code is as

int iCtr = 0;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PictureBox picture = new PictureBox
                {
                    Name = "pictureBox"+i,
                    Size = new Size(316, 320),
                    Location = new Point(1, iCtr * 1100 + 1),
                    Visible = true
                };
               // string fname = dt.Rows[2]["FileName"].ToString();
                picture.ImageLocation = dt.Rows[i]["FileName"].ToString();
                //@"..\Images\80knhk00003.jpg";
                pnlDisplayImage.Controls.Add(picture);
                iCtr++;
            }



dt是可数据的.

这样,我只能看到最后一张图像,而不能看到所有图像.即使最后一张图像很小,也无法显示完整的图像.(即,我只能看到实际图像的一个角).

如何给图像设置尺寸以便可以完全查看?
以及如何在行中显示图像?

请帮忙
谢谢



where dt is datable.

with this I can see only last image but not all images. Even last image is very small and complete image is not shown.(i.e. I can view only one corner of actual image).

How can I give size to image so that it can be viewed completely?
And how can I display images in row?

Please help
Thanks

推荐答案

选中此
http://msdn.microsoft.com/en-us/library/aa479350.aspx [ ^ ]
如何在Gridview中动态绑定所有单元格的图像&从单元格获取值 [
check this
http://msdn.microsoft.com/en-us/library/aa479350.aspx[^]
How to Bind Images in Gridview all cells dynamically & get values from cell[^]


这篇关于在行中动态添加图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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