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

Changing font attributes of individual items in Listview?

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
Nov 20 '05 #1
4 8941
* "Larry" <La***@froghaven.com> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
* "Larry" <La***@froghaven.com> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
"Larry" <La***@froghaven.com> schrieb
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.UseItemStyleForS ubItems = True.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
"Larry" <La***@froghaven.com> schrieb
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.UseItemStyleForS ubItems = True.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

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

Similar topics

4
by: Colleyville Alan | last post by:
I am trying to use a list box to allow users to select items, the results are queried based on the selection and written to a spreadsheet. If the item already exists on their current spreadsheet,...
0
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I...
3
by: Robert Misiak | last post by:
Is it possible to have a different font in individual listView columns? When I do something like: ListViewItem lsi; .... lsi.SubItems.Font = new Font (lsi.SubItems.Font,...
1
by: Do | last post by:
Hi, In my listbox, I'd like to change the color of some listitems depending on user security. I tried wrapping the <font color=red></font> around my listitme's .text property, but the tags...
3
by: mkiger | last post by:
Hey Guys. I'm making an asp.net app and I have a question regarding listboxes. I have a list box and I would like some of the items to be bold based on certian criteria. Is this possible? matt
0
by: Larry | last post by:
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...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
1
by: plmanikandan | last post by:
Hi, I have a listview with items,subitems.I tems and subitems are added as below listView1.View = View.Details; listView1.Columns.Add("Column 1", 100,HorizontalAlignment.Center);...
1
by: Alan T | last post by:
How do I set a particular listview item text to bold?
7
by: bstieve | last post by:
Hi all, i'm looking at the next problem. i'm trying to get the names of attributes of object or of types. example class test private name as string sub new (byval test as string) me.name =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.