【问题标题】:Create more imagelist at runtime在运行时创建更多图像列表
【发布时间】:2014-10-04 07:38:12
【问题描述】:

您好如何在运行时创建 2 个或更多图像列表。 示例:

 for (int c = 0; c < 5; c++)
 {
    ImageList imageList+c = new ImageList();
 }

我必须为 imagelist 名称添加 int c 编号并创建 imagelist。(对不起我的英语不好)

我想要输出:

图像列表0

图像列表1

图像列表2

图像列表3

图像列表4

谢谢!

【问题讨论】:

  • 你不能。你到底想要什么? ImageList 数组?

标签: c# imagelist


【解决方案1】:

您可能希望以不同的方式执行此操作,例如将其存储到列表中。

List<ImageList> imgList = new List<ImageList>();
for (int i = 1; i < 5; i++)
{
    imgList.Add(new ImageList());                
}

// get the first imgList Images.Count property
int imgCnt = imgList[0].Images.Count;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-18
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多