473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Listview image question.

All,

I have a listview and I want to add an image to each row (detail view) to
acompany the row text.
However I simply want the image to be a square block coloured in, in a
particular colour

For example I want the image of row 0 to be a red square, row 1 to be a blue
square , row 3 to be a green square etc etc.
WITHOUT using a red bitmap and a blue bitmap and a green bitmap in an
imagelist is there anyway to created these images dynamically - they are
after all just coloured squares.

Thanks

Nov 17 '05 #1
1 5824
Paul,

You can easily do this. All you have to do is create a Bitmap instance,
get the device context (Graphics instance) using the static FromImage method
on the Graphics class, and paint it the color you want (three times).

Once you have those images, you can add them to your imagelist, and it
should work. Just make sure that when creating the bitmaps that it is the
right size and resolution (in terms of bits per pixel).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul Tomlinson" <ru************@hotmail.com> wrote in message
news:ue**************@TK2MSFTNGP09.phx.gbl...
All,

I have a listview and I want to add an image to each row (detail view) to
acompany the row text.
However I simply want the image to be a square block coloured in, in a
particular colour

For example I want the image of row 0 to be a red square, row 1 to be a
blue square , row 3 to be a green square etc etc.
WITHOUT using a red bitmap and a blue bitmap and a green bitmap in an
imagelist is there anyway to created these images dynamically - they are
after all just coloured squares.

Thanks

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Silvia | last post by:
Hi, I have a program that capture images and put this into a listview (using imagelist), the problem is when I delete de image the listview, when do that and capture another image, the image...
1
by: Mark Doggett | last post by:
Hi I have a listview control with four columns. The problem I have is that the second column needs to display an image but as it is a subitem this doesn't appear to be able to be done. Does...
3
by: Vagabond Software | last post by:
I'm trying to display thumbnail images in a Listview that look more like the Windows thumbnail view. Everything is working pretty good, but my thumbnails are decidedly not like the Windows...
13
by: Maheshkumar.R | last post by:
hi groups, I have placed an listview control, i want to iterate thru the control and find the clicked event items. listView2.Items.Add(fname.ToString(), i); how i can perform the iteration...
0
by: Chris Putnam | last post by:
I am working on an application that includes a feature where a directory is spidered and thumbnails are displayed. I have it pretty much down, but when the bitmaps are loaded from file, memory is...
0
by: Silvia | last post by:
Hi, I have a program that capture images and put this into a listview (using imagelist), the problem is when I delete de image the listview, when do that and capture another image, the image...
3
by: Lloyd Sheen | last post by:
I have now googled for a couple of hours with no success. I am looking to find code to create a listview with a background image. I know it can be done but cannot find a link to code or a hint. ...
10
by: Adam Honek | last post by:
This is probably a silly question but oh well, I can't find the answer looking via code. Having an imagelist already, how does one set an icon for a list view's sub items? I'm using the code...
11
by: Alan T | last post by:
Does the ListView supports sort? I want to have a up/down arrow/triangle that show it is sorted asc or desc on the column headers when I click the column header. May be I need a third-party...
5
by: Todd Barlow | last post by:
Hi, When I try to set the BackgroundImage property on a ListView, the project fails to run. Sometimes a generic error message appears telling me that memory might be corrupt. Sometimes the error...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.