Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Change ListView ColumnHeader Color

Is it possible to change the color of individual ColumnHeader text to a different color when the ColumnHeader is clicked?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Change ListView ColumnHeader Color
Is it possible to change the color of individual ColumnHeader text to a different color when the ColumnHeader is clicked?

Datagrid Columnheader Change Color And Convert Date
2 questions in one.

first. i need help to know how change datagrid columnheader background color. I can change letter type, size but i cant change the background.

second. i need to know how convert year '2006' to '06'.

thats all

Columnheader Color
Can anyone tell me how to change the color of the columnheader in ListViewCtrl? Can't find any info.

Columnheader Color
Hello, does anybody know how to change a listview´s columnheader color?

Thanks in advance!

Change Color From Listview

How I change color of the line listview ?

Is possible change the background color only of the a line ?

thank you in advance

Change Color Of Each Row In A ListView
Is this possible to show each row(line) in a listview with a different color?

Change Color Of Gridlines In Listview HOW?
Can this be done?

Can you change the color of gridlines in Listview?


Change The Background Row Color In A Listview
Is it possible to change the background color of an entire row in a listview?

Can One Change Gridline Color In Listview?
How can I change the color of Gridlines or can it even be done?


How To Change A Row Color In A Listview. PLEASSEEEE
How to change a row color in a listview
(but without subclass)

Thanks for answers!

How To Change Color Of Listview Columns
Hi Everyone

I have a listview in an control array and i want to change the color and font bold of some columns in it.
(listview is LvwMain(4) )

The first column i want to change the style to bold and the second column ( subitem(1) ) i want to change the color.

How do i do this?

Thanks in advance

Change Color Of A Listview Subitem

Can anyone tell me how to change the colour of a sub item in the VB6 listview control ?



Change Color Of Listview Subitems
how's that done?
I have :

Listview.ListItems(3).ForeColor = vbRed

to change the color of the text in the first column, but how do I change the color of the text in the other columns?

ListView SubItems Change Color?
My list view is pretty much a log. I place file information there and then the user has the ability to save or delete it. When Saved or Deleted, I want a SubItem to change its color and even underline it. BUT ONLY THE SUBITEM and not the entire line. I can change the color for the very first Header coloumn, but I cant figure out how to do it for the others.

Any help will be appreciated.


Change ListView Header Color?
Is there any way to change the background color of the ListView headers to something other than ButtonFace?

ListView Change Color Of Fullrowselect Cursor

I have a listview in report view with the fullrowselect option.
Then i have a cursor about the full row with black color.

How can i change the color of this bar (cursor).

Please help me.

Thanks Hannes

Change The Highlight Color Of The Listview Control

I found this module code on this forum that lets me change the highlight color of a listbox by subclassing which works correctly. I would like to do the same with a Listview control, I tried building a test project but the class doesn't work on a listview (I replaced all references of Listbox with Listview). Does anybody know what could be wrong? Thank you.

How To Change Text Color Of Listview Item?
Hi all .could any one show me how to change text color of listview item to diffrent colors?Thanks

How To Change Color Of External Listview Item Using Api
Hi all. could any one show me how i can change a color of external listview item using an api.Thanks

Listview Column Header Color Change?
Hi, I would like to change the color of the column header background color and can't find how to do this. I searched all over on here and PSC. Does anyone know how to do this and have a sample code?

Thanks for your help!

Listview: Change Subitem Bkgrd Color

I am using VBA in Access 97.

I have a cross-tab query where the number of columns & name of column headers changes almost everytime the query runs.

I need to display the results of the query in a table format & change the color behind a value based on the value.

I have tried creating a report, but I run out of room going accross - too many columns.

So, I am breaking the results of the query down into teams & using a form with a tab control.

I have tried the following:

1. Created a sub-form: having trouble getting the actual names to show up for column headers & seems rather messy & time consuming. I have 7 tabs to populate, which means 7 forms to create & 7 queries to execute.

2. Datagrid & flexgrid: Oops! They do not work in vba (found this out from this forum. Thank you very much).

3. Listview: Have had the best success with this. All I need now is a way to change the background colors behind values.

I am open to any & all suggestions. While I have VB6 as well, I must complete this task inside Access 97. I believe this means I am stuck with VBA.

Thanks for your help.

Can You Change The BG Color Of A Listview Column Header
Just wondering if you can if so how. (I'm not looking for how to do it on just your computer but anyone who runs the program. So no control panel thing...)

How To Change The Background Color Of Only One Listitem In Listview?
Does anybody know how to set the background color for only one
listitem in listview ?
There is no .backcolor property for listitem and the .backcolor property of listview changes the background color of all the listitems.

Thanks !

ListView With Report Option An FullRowSelect Change Bar Color

I need some help please.

I have a ListView with the report option, and a pick the fullrowselect option. Then i have a full rowselector and can navigate with the cursor keys.

My Question:

How can i change the color (default is black) of the selector (bar !!) in blue or something else.

Please help me.


Hannes from Austria

How To Change Back Color For Listview Alternately For Rows
can some body hint me on to apply backcolor for listview which is in report view. the colors need to be applied alternately for each row (for e.g 1st row blue 2n row yellow 3rd row blue 4th row yellow and so on..)

Mind is faster than Wind --- Mahabharat

Problem Using LVM_SETTEXTBKCOLOR To Change Color Listview Text
I am using this code to change text color of listview selected item. But it never works.Could an expert look at it and tell me what i am doing wrong. The hwnd is corect since the line :


lItemPos = 0& ' first item
SendMessage hwnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM

is working perfectly and is selecing the zero position item for me and highlighting it corectly.
Some people suggest i need to send a refresh using LVM_REDRAWITEMS to listview after setting a color for it. But i do not know how to use LVM_REDRAWITEMS. I be happy if an expert help me fix there problems.Thanks

not working call to LVM_SETITEMSTATE



lItemPos = 0& ' first item
SendMessage hwnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM

'SendMessage hwnd, LVM_SETTEXTBKCOLOR, 0, hexdec(16711935)
'SendMessage hwnd, LVM_SETTEXTBKCOLOR, 0, 16711935
'SendMessage hwnd, LVM_SETTEXTBKCOLOR, 0&, 0&

SendMessage hwnd, LVM_SETTEXTBKCOLOR, 0, 16711935

How To Change Background Color Of Column Header Of Listview In Report Mode?
how can we change listview's columnheaders' backcolor a?


Sabin Kumar Chhetri

ListView ColumnHeader Size
Hi, I'm having a bad flicker problem with resizing a ListView in Report Mode.
I have two columns: one of names, and one of numbers. The one of names changes size as the ListView changes size, and the one of numbers stays the same size and stays against the right side of the ListView. Unfortunately, ListViews seem to only work in Twip mode, and that causes flickering on certain sizes (when it should round up [0.5]). Is there any way to make the ColumnHeaders go to Pixels size, or at least to tell it to round up instead of down?

Listview Columnheader Icons
How do you insert the Icons into the column header in VB 5?

Also how do you program the headers to sort the columns if it has been clicked.


ListView ColumnHeader Colors
I'm working on a form using Listview, and have managed to figure out quite a bit so far in getting it functioning. Now I would like to add to the look of the form. I cannot find any property that will change color of the column header. Could you assist me in how to do this, or an on-line manual that would show this type of information. Thanks.

ListView - ColumnHeader - Bold

I want to make 1 columnheader bold and leave the others as they are.
If a user clicks on a columnheader, it should be bold and alll the others regular font.


ListView - ColumnHeader's Width
Did you see when you double-click over the "border" of the columnheader that its width changes to fit all the info in it? Is there any way to programmatically do this?

ListView - ColumnHeader Tooltips
In looking how to accomplish the task of displaying a tooltip when the user moves the mouse over a given columnheader of a listview, I stumbled across this example:

However, I just want to display a standard tooltip, not a balloon. Do you know what I would need to change in this code to accomplish that?
And also is it possible to accomplish this without all the subclassing?

ListView ColumnHeader Cursor
Hi Everyone,

I am currently using the code provided by Aaron Young to disable ListView column resizing however, I cannot figure out how to stop the cursor from changing while over these non resizable columns. I think I should use the WM_SETCURSOR API but I am unsure how to do it. Does anyone know how to do this? I would appreciate any help. Thank you.

ListView - ColumnHeader - Bold

How can I make just 1 of listview's columnheaders bold?
I want only the one that user clicked on bold.


Resizing The Columnheader In A Listview
Hi All,

I am trying to change the size of a listviews columnheader based on the length of a string.

I am sure there is a better way of doing, it but I have not found it.

Here is what I have so far, but it does not seem to be the exact length as my string.

Any ideas?


Set Itemx = ListView1.ListItems.Add(, , "This is the Test Text ")
If Len(Itemx.Text) * 100 > ListView1.ColumnHeaders(1).Width Then
ListView1.ColumnHeaders(1).Width = Len(Itemx.Text) * 100
End If

Listview Columnheader Re-position
I searched the forums and could not find an answer to this question.

I have a form with 2 listview objects. Both have the same column headers. What I want to do is, when the user re-arranges the columns in listview1, I want to programatically re-arrange the columns in listview2 to match. I can't seem to get this to work. I tried the mouseup, columnclick, & lostfocus events but they do not seem to fire on repositioning of the columns.

Does anyone know how this can be done?


Listview Columnheader Icon On Right
is it possible to put the image in a column header to the right of the text?

}...the bane of my life!

ListView Columnheader AutoSize
I need the column in a listview to adjust its width to fit its contents... How exactly would i achieve this?


Transcending even the highest forms of digital spirituality.

Listview ColumnHeader Property
Why don't I get the property 'Position' in ColumnHeader object
I'am using MSCOMCTL.OCX and Vb6 (sp6)

Private Sub Form_Load()

    Dim colx As ColumnHeader
    Dim colPos As ColumnHeader
    'Let the user reorder the columns
    ListView1.AllowColumnReorder = True
    'Set view to report
    ListView1.View = lvwReport
    'Add some columns
    Set colx = ListView1.ColumnHeaders.Add(, , "Col1")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col2")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col3")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col4")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col5")
    Set colx = ListView1.ColumnHeaders.Add(, , "Col6")
    'Loop though each ColumnHeader object and set the
    'position of it dependent on what the user did
    'the last time
    For Each colx In ListView1.ColumnHeaders
        colx.Position = GetSetting(App.Title, "Settings", "Col" & colx.Index, colx.Index)
        colx.Width = GetSetting(App.Title, "Settings", "ColWidth" & colx.Index, colx.Width)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim colx As ColumnHeader

    'Save the Position of each of the ColumnHeader
    'Objects so we can load them the next time
    'the user starts the program
    For Each colx In ListView1.ColumnHeaders
        SaveSetting App.Title, "Settings", "Col" & colx.Index, _
        SaveSetting App.Title, "Settings", "ColWidth" & colx.Index, _
End Sub


Listview - Lock Columnheader
Hi, how can I lock the column header on top of my listview? I have set it to lvwReport. I have some standard headers wich contain not much data. The headers are big enough to contain all the data. How to lock them?

Sand Hawk

Earth is 98% full. Please delete anybody you can.

Listview Columnheader Icons
How do you add icons to the columnheaders of common control 5 listviews? I using common control 5 for xp styles.

ListView: ColumnHeader With Icon Will Not Right-align
I have a ListView with four ColumnHeaders.

The first three ColumnHeaders have icons to indicate the sorted column and the direction of the sort.

The last two ColumnHeaders are supposed to be right-aligned.

The third ColumnHeader is left-aligned even though I set the alignment to be right-aligned.

The fourth ColumnHeader is the only one without an icon and it is right-aligned like it should be.

It looks like if an icon is specified for a ColumnHeader it automatically makes it left-aligned. Is there anyway to have an icon and be right-aligned?

Here is my code for creating the columnheaders:

Set ObjLstColHeader = lstTransactions.ColumnHeaders.Add(, , "DATE & TIME", 2500, lvwColumnLeft, "SORT_ASC")
Set ObjLstColHeader = lstTransactions.ColumnHeaders.Add(, , "TYPE", 1400, lvwColumnLeft, "BLANK")
Set ObjLstColHeader = lstTransactions.ColumnHeaders.Add(, , "AMOUNT", 2000, lvwColumnRight, "BLANK")
Set ObjLstColHeader = lstTransactions.ColumnHeaders.Add(, , "BALANCE", 2000, lvwColumnRight)
Any thoughts?


Listview Columnheader Icon Question
I am presenting data in a listview and am having a problem with columnheader icons. I am displaying an up or down arrow icon to indicate the sort order and I want to remove the icon from the header if the user selects a different column. The only method that I have come up with is to clear and readd all columns to the collection but this is slow and clumsy looking. Is there another option? Thanks in advance for all help.

Print Listview Listitems And Columnheader
How to set the A4 paper to print the listview listitems and listview column header as lanscape or potrait?By default it print as potrait. So How to set the paper to print as lanscape if the columnheader reach the A4 limit margin size?


'Print Column Header
Dim head As ColumnHeader
Dim colColumnIndexes As Collection
Dim Idx As Long
Dim iTab As Long

Set colColumnIndexes = New Collection
iTab = 5
Printer.FontUnderline = True
'Print the column headers and load the collection of
'column indexes that will be used when printing the ListView data.
For Idx = 0 To printtext.List2.ListCount - 1
For Each head In Form5.ListView2.ColumnHeaders
If printtext.List2.List(Idx) = head.Text Then

Printer.Print Tab(iTab); printtext.List2.List(Idx);
iTab = iTab + 30
colColumnIndexes.Add head.SubItemIndex

End If


Printer.Print vbCrLf
'Print ListItem
Dim item As ListItem
Dim strItem As String
For Each item In Form5.ListView2.ListItems
iTab = 5
For Idx = 1 To colColumnIndexes.Count
Printer.FontUnderline = False
If colColumnIndexes(Idx) = 0 Then 'this is not a subitem, so print the listitem data
strItem = item.Text
strItem = item.ListSubItems(colColumnIndexes(Idx)).Text
End If
Printer.Print Tab(iTab); strItem;
iTab = iTab + 25


Right Click ColumnHeader In ListView To PopupMenu
What would be the easiest way to make a popupmenu on a right click of the mouse, on the column header section?

The mouseup event on a listview doesn't happen if you click the header.
The column_Click event doesn't have a button variable.

Picture Below

ListView ColumnHeader Icons (with ImageList)
Haven't done this before so I thought I would give it a shot. I am able to sort the ListView columns by clicking on the ColumnHeader without a problem. But now I would like to add an icon to the ColumnHeader from an ImageList to show the sorting order.

This is what I have:
1) ListView = lvwPrefixes
2) Image List = ImageListPrefixesListView
3) Two icons, one with a Key called Ascending for image index 0 and another with a Key called Descending for the image index 1

The icon isnt displaying because I have no idea how to reference the image list in the code. Searched and found nothing useful so far.

Please advise, thanks in advance.

The current code is:

VB Code:
Private Sub lvwPrefixes_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)    With Me.lvwPrefixes        If .SortOrder = lvwAscending Then            .SortOrder = lvwDescending            .ColumnHeaders.Icons = "Descending"        Else            .SortOrder = lvwAscending            .ColumnHeaders.Icons = "Ascending"        End If                .SortKey = ColumnHeader.Index - 1    End WithEnd Sub

I also have

VB Code:
Me.lvwPrefixes.Sorted = True

in the Form_Load event of the form

Sorting Off A ListView ColumnHeader Click
Before I go about coding something that's already built in I just want to make sure:

I need users to be able to sort the ListView by clicking the different ColumnHeaders (ala Outlook Inbox.)

I'm ready to write the code from scratch, but I just want to make sure that I'm not writing code for something that I could do with an API.

Copyright © 2005-08, All rights reserved