473,320 Members | 2,004 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.

ListView Header Icon

I want to put an Icon on the right side of a column header when the column
is clicked I found some basic code that I am trying to use, but nothing so
far.

Public Sub ShowHeaderIcon(ByVal colNo As Long, _
ByVal imgIconNo As Long, _
ByVal showImage As Long)

Dim hHeader As IntPtr
Dim HD As HD_ITEM

'get a handle to the listview header component
hHeader = SendMessage(listview1.Handle, LVM_GETHEADER, 0, 0)

'set up the required structure members
With HD
.mask = HDI_IMAGE Or HDI_FORMAT
.pszText = listview1.Columns(colNo).Text
If showImage Then
.fmt = HDF_STRING Or HDF_IMAGE Or HDF_BITMAP_ON_RIGHT
.iImage = imgIconNo
Else
.fmt = HDF_STRING
End If
End With

'modify the header

Call SendMessage(hHeader, HDM_SETITEM, colNo, HD)

Nov 21 '05 #1
1 2038
Hi,

There is an example in this sample on the code project website

http://www.codeproject.com/vb/net/ExpCombo.asp

Ken
----------------------
"Lespaul36" <le*******@none.net> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
I want to put an Icon on the right side of a column header when the column
is clicked I found some basic code that I am trying to use, but nothing so
far.

Public Sub ShowHeaderIcon(ByVal colNo As Long, _
ByVal imgIconNo As Long, _
ByVal showImage As Long)

Dim hHeader As IntPtr
Dim HD As HD_ITEM

'get a handle to the listview header component
hHeader = SendMessage(listview1.Handle, LVM_GETHEADER, 0, 0)

'set up the required structure members
With HD
.mask = HDI_IMAGE Or HDI_FORMAT
.pszText = listview1.Columns(colNo).Text
If showImage Then
.fmt = HDF_STRING Or HDF_IMAGE Or HDF_BITMAP_ON_RIGHT
.iImage = imgIconNo
Else
.fmt = HDF_STRING
End If
End With

'modify the header

Call SendMessage(hHeader, HDM_SETITEM, colNo, HD)


Nov 21 '05 #2

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

Similar topics

0
by: John T | last post by:
I have the code I need to show a sort icon in the column header of a ListView control. The issue I have is that the image is always on the right side of the column header text. This isn't...
2
by: Dan | last post by:
Hi, I would like my list view controls column headers to display a "down arrow / triangle" to indicate by which column they are sorted. I don't want the ListView to actually sort any data as...
3
by: scoobydoo | last post by:
hi, I have a problem displaying icons at the right colour depthin a ListView. I've made an icon file, (using IconWorkshop 5), it has 3 icons within it. A 32x32 32bpp XP style icon, a 32x32...
8
by: Kovan A | last post by:
i need to change the fore and back colours of the headers of listview, as well as put a icon in the header, any snippet would be helpful, thank you
2
by: Li Pang | last post by:
Hi, I used some code to add an arrow icon onto a listview header column for the sorting purpose. However, after the icon added, the TextAlign of the column becomes "left", if I enforced...
0
by: p19010101 | last post by:
Using sample codes from msdn and code snippets from this group, I am able to derive a custom listivew user control with column sorting and up/down icons in the column header. It works fine except...
11
by: Alan T | last post by:
Does the ListView supports sort? I want to have a up/down arrow/triangle that show it is sorted asc or desc on the column headers when I click the column header. May be I need a third-party...
1
by: Dave Griffiths | last post by:
Hi All Using VB.Net 2005 pro When I click on a column header to sort my Listview I would like to have the sort order displayed like many programs dom with the small Icon pointing up or down....
1
by: Andi | last post by:
Hi, I have added a soring icon to a ListView column header when the user clicks on it. I want to remove this icon, when the user clicks on another column by setting the image index to -1. That...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.