473,614 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different font in separate listView columns

Is it possible to have a different font in individual listView columns?
When I do something like:

ListViewItem lsi;
....
lsi.SubItems[0].Font = new Font (lsi.SubItems[0].Font,
lsi.Font.SubIte ms[0].Style | FontStyle.Bold) ;

The entire line (all columns) of the list appears in bold. I just want the
first item to be bold.

Thank you,
Robert
Nov 16 '05 #1
3 7012
Hello Robert,

Just to be safe - try to carry out the same procedure on any other index
than 0. If this fails, I'm afraid you'll have to resort to custom drawing to
achieve that.
I've reviewed the LVM_SETITEM message documentation, but even this seems to
not allow setting a font for a particular item.

"Robert Misiak" <ch***********@ yahoo-cut.this.part.o ut-.com> wrote in
message news:XC******** *****@newsread2 .news.pas.earth link.net...
Is it possible to have a different font in individual listView columns?
When I do something like:

ListViewItem lsi;
...
lsi.SubItems[0].Font = new Font (lsi.SubItems[0].Font,
lsi.Font.SubIte ms[0].Style | FontStyle.Bold) ;

The entire line (all columns) of the list appears in bold. I just want the first item to be bold.

Thank you,
Robert


Nov 16 '05 #2
Robert Misiak wrote:
Is it possible to have a different font in individual listView columns?
When I do something like:

ListViewItem lsi;
...
lsi.SubItems[0].Font = new Font (lsi.SubItems[0].Font,
lsi.Font.SubIte ms[0].Style | FontStyle.Bold) ;

The entire line (all columns) of the list appears in bold. I just want the
first item to be bold.


Hi Robert,

you have to set the ListViewItem.Us eItemStyleForSu bItems property to false.

If you later change the appearance of the ListViewItem it will
over-write the appearance of the ListViewSubItem permanently. Plan ahead.

Cheers

Arne Janning
Nov 16 '05 #3
"Arne Janning" <sp************ *****@msn.com> wrote in message
news:uk******** ******@TK2MSFTN GP09.phx.gbl...
Robert Misiak wrote:
Is it possible to have a different font in individual listView columns?
When I do something like:

ListViewItem lsi;
...
lsi.SubItems[0].Font = new Font (lsi.SubItems[0].Font,
lsi.Font.SubIte ms[0].Style | FontStyle.Bold) ;

The entire line (all columns) of the list appears in bold. I just want the first item to be bold.
Hi Robert,

you have to set the ListViewItem.Us eItemStyleForSu bItems property to

false.
If you later change the appearance of the ListViewItem it will
over-write the appearance of the ListViewSubItem permanently. Plan ahead.

Cheers

Arne Janning


Thanks, Arne! It works.

Robert
Nov 16 '05 #4

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

Similar topics

0
700
by: Nuke van Dyke | last post by:
Hi, I'm searching for an advanced TextArea GUI Component. Should be written in Swing. Possible open source!! It should handle - stylings like underline, bold, italic, colors - different font-sizes - optional support for embedded pictures
2
3691
by: John | last post by:
Now and again I like to start a sentence with a large capital, maybe in a different font. This upsets the line spacing and I've failed to find any css that will effectively crop the capital letter from the bottom, to allow the line spacing of the following smaller font text to remain unaffected. I've always had to resort to a graphic for the leading capital - is there a way I can do this with css? Thanks John
4
6782
by: Glen K | last post by:
The following works in Firefox buy not in Internet Explorer: <select> <option> option1 </option> <option style="font-style: bold"> option2 </option> </select> Are there any workarounds to allow IE to show different font styles for different elements in a select list?
0
2549
by: Samuel R. Neff | last post by:
I'm having a index problem with ListView SubItems. If I add multiple columns to the listview and then add items with associated subitems, the ListView displays fine. Then if I delete a column via ListView.Columns.RemoveAt() then the ListView still displays fine. However, if I grab a subitem value via listView.Items.SubItems.Text Then I get the Text of the wrong column.
1
5198
by: Scott Kay | last post by:
Hi, When I use the AllowColumnReorder in the ListView Control, this allows the user to reorder columns by dragging them around. Any items added to the control after the user has reordered them appear in the correct column (this is good). Is there any way to determine what the original ordinal position of the column was before it was reordered?
3
3276
by: Rob Richardson | last post by:
Greetings! I am attempting to display data in tabular form using a ListView control in detail mode. This is for a program I originally wrote in VB6. In VB6, I would add an item to the ListView, and the item would automatically have the correct number of subitems, which I could access using array syntax. That doesn't seem to be the case in VB .Net. I tried creating a two-column listview. I added an item, and then tried to set the...
5
7265
by: billuy | last post by:
Is there a way to sort by a specified column in a listview? I'd like my users to be able to click on the column heading and have the listview sort by that column. Thanks, Billyb
0
1149
by: --== Alain ==-- | last post by:
Hi, i would like to custom my ListView control by making a particular property editor for ListView.Columns property. Basically, i want to allow use to choose among several types of columns (with checkboxes, with progressbars, only text, with images,..) for that i thought it could be good to create a special property editor for Columns (columnheadercollection type).
4
5450
by: CyberSoftHari | last post by:
I am suppose to show a product name in english and another language as well. EX: PRODUCT NAME | PRODUCT NAME (Tamil) | PRICE | HOW do i set different font column in any list type controls. Any related ideas welcome. THANK YOU.
0
8176
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
8620
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...
0
8571
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8265
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
8423
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7047
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
6085
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
5537
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();...
1
1705
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.