在运行时创建图片盒 [英] creating pictureboxed at runtime

查看:63
本文介绍了在运行时创建图片盒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在一个循环中创建了几个图片框对象,然后使用计时器将它们中的每个对象移到某个方向(自动-没有按键或任何东西).
我的问题是,在某个时候我需要将1个picurebox(p1)放在另一个purebox(p2)上,但是由于我在p2之前创建了p1,所以p1始终位于p2后面(带到前面对它不起作用)我..
您可以提出任何解决方案吗?
我从数据库中获得图片的顺序,所以我不能只是自己更改顺序..

希望您能在没有代码的情况下理解我..:/

Hi
Im creating several picturebox objects in a loop and I''m using timer to move each one of them to some direction (automatic - no keypress or anything).
my problem is that at some point I need that 1 picurebox(p1) will stand on another one(p2), but since I''ve created p1 before p2 , p1 is always behind p2 (bring to front isn''t working for me..
can you suggest any solution ?
I get the picture order from a database so I can''t just change the order myself ..

hope you understand me without the code.. :/

推荐答案

从Controls数组中删除它,并在末尾重新插入它:
Remove it from the Controls array and reinsert it at the end:
Controls.Remove(myPictureBox)
Controls.Add(myPictureBox)

最后添加的对象将位于其他对象之上.
或者,将它们按所需顺序排序,然后按该顺序一次将它们全部添加.
请记住,您也可以使用SQL ORDER BY子句来选择从数据库返回记录的顺序.

The last added object will be on top of the others.
Alternatively, sort them into the order you do want, and add them all at once in that order.
Remember that you can use the SQL ORDER BY clause to select the order in which records are returned from your DB as well.


这篇关于在运行时创建图片盒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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