图像显示问题 [英] Image displaying Problem

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

问题描述


在我的数据视图中,我有2到8张图像.我正在将这些图像分配给图像控件.
例如:
imgFifth.ImageUrl = dv [r.Next(0,dv.Count-1)] [2] .ToString();
即在数据视图中随机显示图像.
但有时相同的图像出现两次或三次.
想避免它.
例如,如果imgFirst中贴有1张图片,它将不会出现在imgSecond中.
有什么办法吗?(不要忘记随机)
致以问候
Sreejith

Hi,
In my dataview i have 2 to 8 images.i am assigning these images to image control.
for eg:
imgFifth.ImageUrl = dv[r.Next(0, dv.Count - 1)][2].ToString();
ie randomly displaying images in the dataview.
but sometimes same images is appearing twice or thrice.
iwant to avoid it.
ie if 1 image appered in imgFirst it wont appear in imgSecond.
Is there any way to do that?(dont forget about random)
With Regards
Sreejith

推荐答案

创建图像列表.然后,从该列表中拉出图像名称,并随即删除它们,以使该列表仅包含未使用的图像.或检查是否有随机随机播放功能,您可以在列表上调用并按顺序进行.
Create a list of your images. Then, pull your image names from that list, and delete them as you go, so that the list only contains images that have not been used. Or check if there''s a random shuffle function you can call on a list and just go in order.


或者,如果您希望维护已使用的图像列表,则可以.在分配下一个之前,请确认列表中不存在该对象,即先前尚未使用过.
Alternatively if you want you can maintain a list of images that has already been used. Before assigning the next one, verify that it does not exist in the list i.e. not already been used earlier.


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

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