473,406 Members | 2,220 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,406 software developers and data experts.

Listview and Icons

I have a Listview in Detail Mode. No i create lines with

ListViewItem lvwItem = new ListViewItem();
lvwItem = new System.Windows.Forms.ListViewItem(new System.Windows.Forms.ListViewItem.ListViewSubItem[] {
new System.Windows.Forms.ListViewItem.ListViewSubItem( null, "text1", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)))),
new System.Windows.Forms.ListViewItem.ListViewSubItem( null, "text2", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)))),
}, -1);
lvwItem.UseItemStyleForSubItems = false;

and add this to the listview

Now i want a icon displayd instead of "text2" - does anyone know how this works, i didn't find
something on the net!

I thought that i can change the lvwItem.subitem[1], before adding them to the listview,
but there is only a text and no image value.

Thanks


Matthias
Nov 15 '05 #1
2 5999
Matthais,

In this case you will have to override the painting of the ListView and
paint the icon yourself. You will also have to create a mechanism to
associate an icon with a particular item in the ListView.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Matthias Kwiedor" <cr********@hotmail.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
I have a Listview in Detail Mode. No i create lines with

ListViewItem lvwItem = new ListViewItem();
lvwItem = new System.Windows.Forms.ListViewItem(new System.Windows.Forms.ListViewItem.ListViewSubItem[] { new System.Windows.Forms.ListViewItem.ListViewSubItem( null, "text1", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window,
new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)))), new System.Windows.Forms.ListViewItem.ListViewSubItem( null, "text2", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window,
new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)))), }, -1);
lvwItem.UseItemStyleForSubItems = false;

and add this to the listview

Now i want a icon displayd instead of "text2" - does anyone know how this works, i didn't find something on the net!

I thought that i can change the lvwItem.subitem[1], before adding them to the listview, but there is only a text and no image value.

Thanks


Matthias

Nov 15 '05 #2
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>
wrote in news:ez**************@TK2MSFTNGP09.phx.gbl:
Matthais,

In this case you will have to override the painting of the
ListView and
paint the icon yourself. You will also have to create a mechanism to
associate an icon with a particular item in the ListView.

Hope this helps.


Thank you Nicholas,

i hope i will find some examples. But you lead me to a new way :)

Greets
Matthias
Nov 15 '05 #3

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

Similar topics

0
by: Charles A. Lackman | last post by:
Hello, I am having a difficult time trying to get the ListView to Inset an new item at a particular index (Using Small or Large Icons). The following is an example: Private Sub...
0
by: Goldsworth_Systems | last post by:
On a VB6 form, I have a listview control associated with an imagelist control. The icons from the imagelist control (ImageList1) to display in the listview control (ListView1) are set by the...
3
by: Ian | last post by:
Hi, I've been trying to create a listview and treeview with icons. You would think it's a pretty straight forward task. API documentation states you simply assign an ImageList - that's been...
3
by: scoobydoo | last post by:
hi, I have a problem displaying icons at the right colour depthin a ListView. I've made an icon file, (using IconWorkshop 5), it has 3 icons within it. A 32x32 32bpp XP style icon, a 32x32...
3
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data,...
1
by: Víctor | last post by:
I'm doing a kind of file explorer with some additional funcionalities. The problem is that I'm not able to draw file extension icons in a ListView. I know how obtain icons, but when I try to draw...
3
by: Steve | last post by:
I have windows form with ListView control. The ListView control has few columns which user can sort by clicking the column header. I want the column header have the small triangle indicator of...
1
by: Sander R | last post by:
Hi, I can't get the the listview (or toolbar) to display the alpha channels of XP icons correctly. I have a manifest file for my binary, and the xp theme is applied correctly. It is only the...
4
by: Ira Siyal | last post by:
Hi I had a project in VB6 which I upgraded to VB.NET recently. In the app, I am facing some issue with listview control. In the earlier app, I have set the Icons in listview through an...
0
by: twoSeven | last post by:
hi, Here is what i want to do. I am making a file and folder browser similar to Windows Explorer with a treeview and listview.. In that, i get icons and thumbnails of a particular file/folder from...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.