473,666 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8980
* "Larry" <La***@froghave n.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.F ont = New Font(ListViewIt em1.Font, _
ListViewItem1.F ont.Style Or FontStyle.Bold)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
* "Larry" <La***@froghave n.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.F ont = New Font(ListViewIt em1.Font, _
ListViewItem1.F ont.Style Or FontStyle.Bold)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
"Larry" <La***@froghave n.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.ListViewI tem.UseItemStyl eForSubItems = True.
--
Armin

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

Nov 20 '05 #4
"Larry" <La***@froghave n.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.ListViewI tem.UseItemStyl eForSubItems = 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
5101
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, I'd like to indicate that so that they do not choose the same item a second time. Right now, I have the listbox show those items that are already on the spreadsheet using the selection property (selected = true). But that actually increases...
0
2612
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 cannot change the size of the ListView's font (ListView.Font) from e.g.
3
7023
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, lsi.Font.SubItems.Style | FontStyle.Bold); The entire line (all columns) of the list appears in bold. I just want the first item to be bold.
1
10561
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 show up in the page load. What can I do here?
3
2856
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
339
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 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...
7
2955
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 already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
1
5225
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); listView1.Columns.Add("Column 2", 100,HorizontalAlignment.Center); listView1.Columns.Add("Column 3", 100,HorizontalAlignment.Center); listView1.Columns.Add("Column 4", 100,HorizontalAlignment.Center); System.Windows.Forms.ListViewItem itmp = new
1
32357
by: Alan T | last post by:
How do I set a particular listview item text to bold?
7
1162
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 = test
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7378
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.