Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Images.resx

Posted on 2009-07-13
1
Medium Priority
?
213 Views
Last Modified: 2012-05-07
I have a images.resx and have included this into my classLib but I get error when running my program telling me that I miss a dll file or something.

The images.resx I have found on the net and I would like to use it, but how do I add it to my project so I can use it?

What do you need to know?

Here is the image.resx I want to add
http://www.2shared.com/file/6685760/cadae3f0/Images.html

0
Comment
Question by:Mickeys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
topdog770 earned 2000 total points
ID: 24855266
Here's a simple start
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Resources;
using System.Reflection;
using System.Collections;
 
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        ResXResourceReader r = new ResXResourceReader("..\\..\\Images.resx");
        IDictionaryEnumerator en; 
 
        public Form1()
        {
            InitializeComponent();
 
            this.Load += new EventHandler(Form1_Load);
        }
 
        void Form1_Load(object sender, EventArgs e)
        {
            r = new ResXResourceReader("..\\..\\Images.resx");
 
            en = r.GetEnumerator();
 
            while(en.MoveNext())
            {   
                DictionaryEntry de = (DictionaryEntry)en.Current ;
 
                this.imageList1.Images.Add(de.Key.ToString(), de.Value as Image);
                this.imageList2.Images.Add(de.Key.ToString(), de.Value as Image);
 
                this.listView_Resources.Items.Add(de.Key.ToString(), de.Key.ToString());
            }
 
            en = r.GetEnumerator();
            GetNextResource();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            GetNextResource();
        }
 
        private void GetNextResource()
        {
            if (en != null)
            {
                en.MoveNext();
 
                Bitmap b = ((DictionaryEntry)en.Current).Value as Bitmap;
 
                this.pictureBox1.Image = b;
            }
        }
 
        private void listView_Resources_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listView_Resources.SelectedItems.Count > 0)
            {
                if (imageList2.Images.ContainsKey(listView_Resources.SelectedItems[0].Text))
                {
                    this.pictureBox1.Image = imageList2.Images[listView_Resources.SelectedItems[0].Text];
                }                
            }
        }
 
        #region Designer Code
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.listView_Resources = new System.Windows.Forms.ListView();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.imageList2 = new System.Windows.Forms.ImageList(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // pictureBox1
            // 
            this.pictureBox1.Location = new System.Drawing.Point(132, 13);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(198, 239);
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
            this.pictureBox1.TabIndex = 0;
            this.pictureBox1.TabStop = false;
            // 
            // listView_Resources
            // 
            this.listView_Resources.Location = new System.Drawing.Point(12, 13);
            this.listView_Resources.Name = "listView_Resources";
            this.listView_Resources.Size = new System.Drawing.Size(114, 239);
            this.listView_Resources.SmallImageList = this.imageList1;
            this.listView_Resources.TabIndex = 2;
            this.listView_Resources.UseCompatibleStateImageBehavior = false;
            this.listView_Resources.View = System.Windows.Forms.View.SmallIcon;
            this.listView_Resources.SelectedIndexChanged += new System.EventHandler(this.listView_Resources_SelectedIndexChanged);
            // 
            // imageList1
            // 
            this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
            this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            // 
            // imageList2
            // 
            this.imageList2.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
            this.imageList2.ImageSize = new System.Drawing.Size(71, 96);
            this.imageList2.TransparentColor = System.Drawing.Color.Transparent;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(339, 261);
            this.Controls.Add(this.listView_Resources);
            this.Controls.Add(this.pictureBox1);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.ListView listView_Resources;
        private System.Windows.Forms.ImageList imageList1;
        private System.Windows.Forms.ImageList imageList2;
        #endregion
    }
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question