其实也不会啦,或者你可以单独写一个类,封装ImageList,然后在全部的类中去调用它

解决方案 »

  1.   

    可以专门写一个imagelist放图形的类,当你需要什么样的图形时就对该 imagelist进行重写图片存放地址!
      

  2.   

    同意snof
    ps:snow wolf==>snof 历害
      

  3.   

    我在程序中用过一个好方法, 现公布如下:比如,在一个项目中有一个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;