Hi,
Here the function I used to add the arrow onto the column header:
Private Sub ShowHeaderIcon(ByVal colNo As Integer, ByVal imgIconNo As
Integer, ByVal showImage As Boolean)
Dim hwnd As IntPtr
Dim lret As IntPtr
Dim i As Integer
Dim col As LVCOLUMN
'Assign the ImageList to the header control.
'The header control includes all columns.
'Get a handle to the header control.
hwnd = SendMessage(Me.ListView1.Handle, LVM_GETHEADER, 0, 0)
lret = SendMessage(hwnd, HDM_SETIMAGELIST, 0,
(ImageList1.Handle).ToInt32)
col.mask = LVCF_FMT Or LVCF_IMAGE
'col.fmt = LVCFMT_IMAGE Or LVCFMT_BITMAP_ON_RIGHT
'The image to use from the Image List.
'col.iImage = iconImage ' first image
col.cchTextMax = 0
col.cx = 0
col.iOrder = 0
col.iSubItem = 0
col.pszText = IntPtr.op_Explicit(0)
If showImage Then
'.fmt = HDF_STRING Or HDF_IMAGE Or HDF_BITMAP_ON_RIGHT
col.fmt = LVCFMT_STRING Or LVCFMT_IMAGE Or LVCFMT_BITMAP_ON_RIGHT
'.iImage = imgIconNo
col.iImage = imgIconNo 'iconImage ' first image
Else
'.fmt = HDF_STRING
col.fmt = LVCFMT_STRING
End If
'Send the LVM_SETCOLUMN message.
'The column to which you are assigning the image is defined in the
third parameter.
lret = SendMessage(Me.ListView1.Handle, LVM_SETCOLUMN, colNo, col)
End Sub
As you can see the icon is added ate the right of the header title. It works
fine when the column textalign = left, but got the trunble when the
textalign= right.