问题数组控制为:texbox,picturebox [英] Problem array control as:texbox,picturebox

查看:97
本文介绍了问题数组控制为:texbox,picturebox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS2005.
我正在制作一个``用户控件''.我的控件将在按下按钮时添加一个图片框.该图片框的坐标为x =图片框final.x
每个 picturebox.picture 都将获得一个包含文件中图像的路径.需要创建图像控件数组.添加后该数组的长度会增加.
如何调整数组大小并初始化图片框的属性图片"?
感谢

I use VS2005.
I am making a ''user control''.My control will add a picturebox when pressing a button.Picturebox will have coordinates x = picturebox final.x
Each picturebox.picture will get a path which contains images from a file.Need to create an array of image controls.Length of the array will increase after adding.
How to resize an array and initialize attribute ''picture'' of the picturebox?
thank

推荐答案

不要使用数组-使用List< T>相反-您可以将其视为数组,但是它是可扩展的:
Don''t use an array - use a List<T> instead - you can treat it like an array, but it is expandable:
List<Image> myImages = new List<Image>();
myImages.Add(new Image.FromFile(path));



PictureBox没有Picture属性-请改用Image属性.



The PictureBox does not have a Picture property - use the Image property instead.


解决方案1正确d(new Image.FromFile(path))
但是如果您保留Picturebox,则可以为您提供更多帮助.
Solution 1 is right d(new Image.FromFile(path))
but if you keep Picturebox it will help you more.
List<PictureBox> myImages = new List<PictureBox>();


这篇关于问题数组控制为:texbox,picturebox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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