有关IMAGELIST的问题,请大家帮忙
我怎样把图片添加到imagelist中,再就是下面这段代码中的imageliststream,如何赋值?
比如,在一个项目中有一个Form1和一个Form6,
在Form1中有imageList1资源, 可以通过这种方式访问, 让Form6中的toolbar访问Form1中的ImageList资源
//取Form1的资源
System.Resources.ResourceManager resource = new System.Resources.ResourceManager(typeof(Form1));
//取得imagelist1的资源流
System.Windows.Forms.ImageListStreamer imgliststream = ((System.Windows.Forms.ImageListStreamer)(resource.GetObject("imageList1.ImageStream")));
//给Form6中的ImageList赋值
ImageList imglist = new ImageList();
imglist.ImageStream = imgliststream;
toolBar1.ImageList = imglist;
//设置工具条图标索引
toolBar1.Buttons[0].ImageIndex = 0;
toolBar1.Buttons[1].ImageIndex = 1;