oBitmaps = new Bitmap[2]; // Should I maybe use an array of images instead of bitmaps? //System.Resources.ResourceManager oResMan = new System.Resources.ResourceManager("MyScreenSaver.frmMain",System.Reflection.Assembly.GetExecutingAssembly()); System.Resources.ResourceManager oResMan = new System.Resources.ResourceManager(typeof(frmMain)); oBitmaps[0] = (Bitmap) oResMan.GetObject("Img0.jpg"); // oResMan.GetObject("NetMasterLogo") returns null oBitmaps[1] = new Bitmap("c:\\it\\Img1.jpg"); // this works and loads the image into the bitmap array4. At another point in my application I set the image property of the picturebox using the code:
this.pictureBox1.Image = this.oBitmaps[iImage];I don't really understand the code you have in button1_click. I thought the purpose of embedding an image into the exe through the build action of the file properties was that I didn't have to ship the image files but that they would be embedded in the exe.
>private void button1_Click(object sender, System.EventArgs e) >{ > ResourceWriter imageResource = new ResourceWriter("quotes.resources"); > > Image testImage = Image.FromFile(@"c:\test.bmp"); > > imageResource.AddResource("msg1", "This is a string"); > imageResource.AddResource("neil", testImage); > imageResource.Close(); >} > >private void button2_Click(object sender, System.EventArgs e) >{ > ResourceManager imageResManager = new ResourceManager("WindowsApplication1.quotes", Assembly.GetExecutingAssembly()); > > pictureBox1.Image = (Image)imageResManager.GetObject("neil"); > MessageBox.Show((string)imageResManager.GetObject("msg1")); >} >>Three things to note.