[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

URGENT:  Displaying graphics in ListView

Posted on 2003-11-25
3
Medium Priority
?
303 Views
Last Modified: 2012-07-22
Is there an easy way to display graphics in a listView to the left of the items when it is in details mode?  I know there are a lot of third party ones out there, but I don't want to use any of them.  Is there a way to do this easily using the standard ListView?
0
Comment
Question by:jjacksn
[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
  • 2
3 Comments
 
LVL 20

Assisted Solution

by:TheAvenger
TheAvenger earned 1000 total points
ID: 9823293
Review the SmallImageList property of the ListView class. There is also an example where you can see how to use it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformslistviewclasssmallimagelisttopic.asp
0
 
LVL 2

Accepted Solution

by:
jrberg earned 1000 total points
ID: 10109139
This should do it for ya.

1) Establish an ImageList
 
  ImageList imageList = new ImageList();
  imageList.Images.Add( new Icon(@"c:\path\to\icon1") );
  imageList.Images.Add( new Icon(@"c:\path\to\icon2") );
  imageList.Images.Add( new Icon(@"c:\path\to\icon3") );


2) Attach the imagelist to your ListView
  listView.SmallImageList = imageList;

3) Add your list view items
  ListViewItem item1 = listView.Items.Add("item1");
  ListViewItem item1 = listView.Items.Add("item1");
  ListViewItem item1 = listView.Items.Add("item1");

4) Assign images to them by their insert index order first being 0 and 2nd being 1 and so forth.
  item1.ImageIndex = 0;
  item1.ImageIndex = 1;
  item1.ImageIndex = 2;

5) TA-DA!

You will have to work this into your program as you see fit but I hope this example is clear and easy to understand,
Jerry
0
 
LVL 2

Expert Comment

by:jrberg
ID: 10109148
TYPE-O, Step 3 and 4 have TYPE-O's :)  I forgot to make the ListViewItem's seperate I kept using item1 over and over :)  All better now.

3) Add your list view items
  ListViewItem item1 = listView.Items.Add("item1");
  ListViewItem item2 = listView.Items.Add("item2");
  ListViewItem item3 = listView.Items.Add("item3");

4) Assign images to them by their insert index order first being 0 and 2nd being 1 and so forth.
  item1.ImageIndex = 0;
  item2.ImageIndex = 1;
  item3.ImageIndex = 2;

Thanks,
Jerry
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

656 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