Changing font attributes of individual items in Listview?

L

Larry

Although there are font attribute properties for the items in a ListView
component, the complier tells me that they are read-only. Is there any way
to get access and change the font poperties of individual items in the
listview item collection; or is there another control I should consider
using?

My work around for the moment is to use a sub item and show the listview
columns but this takes up more space than I would like and isn't quite as
eliquent as I would like. What I'm after is something simular to windows
showing compressed files in the explorer in a different color font.

-Larry
 
H

Herfried K. Wagner [MVP]

* "Larry said:
Although there are font attribute properties for the items in a ListView
component, the complier tells me that they are read-only. Is there any way
to get access and change the font poperties of individual items in the
listview item collection; or is there another control I should consider
using?

Taken from MSDN:

\\\
ListViewItem1.Font = New Font(ListViewItem1.Font, _
ListViewItem1.Font.Style Or FontStyle.Bold)
///
 
A

Armin Zingler

Larry said:
Although there are font attribute properties for the items in a
ListView component, the complier tells me that they are read-only. Is
there any way to get access and change the font poperties of
individual items in the listview item collection; or is there another
control I should consider using?

You can not change the properties of a Font. You have to create a new Font
and assign it.

Don't forgot to set
System.Windows.Forms.ListViewItem.UseItemStyleForSubItems = True.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top