Click here to Skip to main content
Licence 
First Posted 30 May 2002
Views 50,641
Bookmarked 27 times

ImageList Wizard

By | 25 Nov 2002 | Article
A wizard application for creating ImageLists

Introduction

Creating ImageLists is a very time consuming activity especially when one isn't using VS.NET. ImageList Maker is a .NET powered wizard that will help developers create ImageList Assemblies.

Creating ImageLists with this wizard is a very easy and straight forward process. The application creates a C# source file and when specified it also creates and compiles an assembly.

System Requirements

  • Microsoft Windows 95+ / NT4+
  • Microsoft .NET SDK (version 1.0 release; not Beta 1, 2, etc)
  • A humoristic attitude.

Screenshots:

Generated Source Code

This code is automatically compiled to an assembly DLL for you if you choose the option in the wizard.

namespace MyNamespace 
{
    using System;
    using System.Resources;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Collections;
    using System.ComponentModel;
    
    public class MyImageList 
    {
        private ArrayList imgNames;
        private ImageList _imageList;
        
        // Get Set property for imagelist
        public ImageList TheImageList 
        {
            get 
            {
                return(_imageList);
            }
            
            set 
            {
                _imageList = value;
            }
        }
        
        // Get property for image names 
        public ArrayList ImageNames 
        {
            get 
            {
                return imgNames;
            }
        }
        
        // Constructor
        public MyImageList() 
        {
            _init();    
        }        
        
        // Retrives image index in this image list 
        // by saved filename
        public int GetIndex(string iname) 
        {
            return imgNames.IndexOf(iname);
        }
        
        // Initializing image list
        private void _init() 
        {
            // Creating a resource manager containing the images
            ResourceManager Rm = new ResourceManager(
                "TSIML_MyImageList", GetType().Assembly);
            
            // General
            _imageList = new ImageList();
            _imageList.ImageSize = new Size(
                (int) Rm.GetObject("IWIDTH"),
                (int) Rm.GetObject("IHEIGHT"));
                 
            _imageList.TransparentColor = 
                (Color) Rm.GetObject("ITRANS");
                
            _imageList.ColorDepth = ColorDepth.Depth32Bit;
            
            // Getting image names;
            imgNames = (ArrayList)Rm.GetObject("INAMES");
            
            // Loadng images in the image list
            foreach(object name in imgNames) 
            {
                _imageList.Images.Add(
                    (Image)Rm.GetObject((string)name));
            }
        }
    }
}

How to use the output

Here is a code example to show you how to use the resulting source code by ImageList Maker

// created on 31-5-2002 at 12:03
namespace TrueSoftware 
{
    using System;
    using System.Windows.Forms;
    using System.Resources;
    using MyNamespace;
    
    public class MyImageList_TestApp : Form 
    {
        public MyImageList_TestApp() 
        {
            // General
            Width = 320;
            Height = 200;
            Text = "MyImageList Test Application " +
                "by TrueSoftware";

            StartPosition = FormStartPosition.CenterScreen;
            
            // Creating and Populating a listview
            MyImageList imgMyImageList = new MyImageList();
            ListView lvTestView = new ListView();
            
            // ********************************************
            // Assigning the imgMyImageList.TheImageList to 
            // the listview's LargeImageList
            lvTestView.LargeImageList = 
                imgMyImageList.TheImageList;
            
            // Populating
            foreach(object name in imgMyImageList.ImageNames) 
            {
                lvTestView.Items.Add(
                    (string) name,
                    imgMyImageList.GetIndex((string)name));
            }
            
            // Setting some properties
            lvTestView.Dock = DockStyle.Fill;
            
            // Adding listview to the main form
            Controls.Add(lvTestView);
        }
        
        public static void Main(string[] args) {
            Application.Run(new MyImageList_TestApp() );
        }
    }
}

Updates

22 Nov2002
  • Updated downloads.
09 Aug 2002
  • Beta source code added to Imlmaker.zip
  • Final source code with documentation in progress
01 June 2002
  • Long directory names bug has been solved.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Gevik Babakhani

Web Developer

Netherlands Netherlands

Member



Organisation (No members)

Gevik Babakhani is a software architect currently residing in The Netherlands. He started programming as hobby from the age of 12. His professional career began in 1997. Since then he works fulltime as a software architect. Currently he dedicates time and effort in Microsoft.NET.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionSource code? PinadminChris Maunder1:34 6 Aug '02  
Generalresulting source code PinmemberThomas Freudenberg5:55 31 May '02  
Hi Gevik.
 
Your article sounds really interesting. Additionally I would like to see an example of the generated source code in the article.
 
Regards
Thomas
 
Sonork id: 100.10453 Thömmi
 

Disclaimer:
Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 26 Nov 2002
Article Copyright 2002 by Gevik Babakhani
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid