以下设计器代码总是报错,
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "19.ico");
this.imageList1.Images.SetKeyName(1, "page_excel.ico");
this.imageList1.Images.SetKeyName(2, "icon2_071.ico");
this.imageList1.Images.SetKeyName(3, "icon2_038.ico");
this.imageList1.Images.SetKeyName(4, "icon2_023.ico");
this.imageList1.Images.SetKeyName(5, "刷新2.ico");
this.imageList1.Images.SetKeyName(6, "11.ico"); //这一句报错,这个图标是后来新添加的错误提示数组超出索引,应该是最后图标没有加入进去,但是我在VS IDE中确实已经加入图标,且绑定到按钮
能显示,运行就不行为什么另外 imageList的图标是存储在什么地方?
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "19.ico");
this.imageList1.Images.SetKeyName(1, "page_excel.ico");
this.imageList1.Images.SetKeyName(2, "icon2_071.ico");
this.imageList1.Images.SetKeyName(3, "icon2_038.ico");
this.imageList1.Images.SetKeyName(4, "icon2_023.ico");
this.imageList1.Images.SetKeyName(5, "刷新2.ico");
this.imageList1.Images.SetKeyName(6, "11.ico"); //这一句报错,这个图标是后来新添加的错误提示数组超出索引,应该是最后图标没有加入进去,但是我在VS IDE中确实已经加入图标,且绑定到按钮
能显示,运行就不行为什么另外 imageList的图标是存储在什么地方?
解决方案 »
- ACCESS 行转列
- 图片无法显示,这是什么原因哈?
- c#中tcp应用编程,连接超时,如时设置超过一定时间就抛出异常
- 怎样根据xsd文件生成xml?
- sheet.SaveAs(strName, miss, miss, miss, miss, miss, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, miss, miss, mi
- 关于BER编码的实现
- 发布系统支持多站点管理,多站点管理怎么实现??
- 无法从流中读取字符,哪位高手明白?
- ”automation服务器不能创建对象“错误提示怎样解决
- 请问在浏览网页时,如何编写C#的代码取出网页上某个东西的超文件链接????急急急!!!!!!
- c# 线程和progressbar的一个问题??????????????????????????
- c#类Word项目编号功能(100分给一人,绝不食言)
添加这一行肯定会索引越界
this.imageList1.Images.SetKeyName(6, "11.ico");
imageList1的图标是存储在资源文件里,只要在Image(Collection)添加图片就行
不要直接改动设计器自动生成的代码,不理解他的结构很容易改错的。
1、现在窗体代码文件中的 Form1类中最顶上随便加一个类,如下
public partial class Form1
{
public class someclass
{
}
}
2、编译,报错
3、再去掉刚才加的代码,再编译,OK