使用VS2005开发一个C#程序,嵌入了一些图片资源,比如说0.bmp,1.bmp,...,9.bmp共10张图片,
VS自动生成了_0,_1,..._9共10个属性,但有个问题就是怎么样才能使用一个循环把他们读取出来?还有一个问题,使用ResourceManager的GetObject()获得Bitmap对象,这样的对象需要使用using或者调用Close()嘛?

解决方案 »

  1.   

    为什么要嵌入呢 直接用一个 imagelist 然后把图片添加进来 直接用不就好了么
      

  2.   

    试一试这个
     ResourceManager rm = new ResourceManager("", Assembly.GetExecutingAssembly(), typeof(ResXResourceSet));
                CultureInfo ci = Thread.CurrentThread.CurrentCulture;            ResourceSet rs = rm.GetResourceSet(ci, true, true);
                IDictionaryEnumerator de = rs.GetEnumerator();
                while (de.MoveNext())
                {
                    string key = de.Key as String;
                    Bitmap val = de.Value as Bitmap;
                    
                }
                rs.Close();