ListView Header Icons 
Author Message
 ListView Header Icons

I currently have a function which will add an icon to a listview header
(arrow up and arrow down). The function will retrieve the icon from a
imagelist belonging to the listview. Is there someway I can use the
function to reference a different imagelist other than the one
associated with the listview?
-------------------
Public Sub HDShowHeaderIcon(lv As ListView, colNo As Long, imgIconNo As
Long, showImage As Long)
    Dim lResult                 As Long
    Dim hHeader                 As Long
    Dim objItem                 As HD_ITEM
    Dim imgIcon                 As ImageList

    hHeader = SendMessageLong(lv.hwnd, LVM_GETHEADER, 0, 0)
    With objItem
        .mask = HDI_IMAGE Or HDI_FORMAT
        .fmt = HDF_LEFT Or HDF_STRING Or HDF_BITMAP_ON_RIGHT Or
showImage
        .pszText = lv.ColumnHeaders(colNo + 1).Text
        If showImage Then .iImage = imgIconNo
    End With
    lResult = SendMessage(hHeader, HDM_SETITEM, colNo, objItem)
End Sub
-------------------

Regards,

Elvio Serrao



Fri, 06 Oct 2000 03:00:00 GMT  
 ListView Header Icons

Robert,

VB 'reinitializes' the imagelists constantly, so if you use SendMessage to
attach a different ImageList it will be overruled by VB.
You could create your own ListBox with API calls, then you can even use the
system's ImageList.

Bye

Richard,

---------------------------------------

Quote:

>I currently have a function which will add an icon to a listview header
>(arrow up and arrow down). The function will retrieve the icon from a
>imagelist belonging to the listview. Is there someway I can use the
>function to reference a different imagelist other than the one
>associated with the listview?
>-------------------
>Public Sub HDShowHeaderIcon(lv As ListView, colNo As Long, imgIconNo As
>Long, showImage As Long)
>    Dim lResult                 As Long
>    Dim hHeader                 As Long
>    Dim objItem                 As HD_ITEM
>    Dim imgIcon                 As ImageList

>    hHeader = SendMessageLong(lv.hwnd, LVM_GETHEADER, 0, 0)
>    With objItem
>        .mask = HDI_IMAGE Or HDI_FORMAT
>        .fmt = HDF_LEFT Or HDF_STRING Or HDF_BITMAP_ON_RIGHT Or
>showImage
>        .pszText = lv.ColumnHeaders(colNo + 1).Text
>        If showImage Then .iImage = imgIconNo
>    End With
>    lResult = SendMessage(hHeader, HDM_SETITEM, colNo, objItem)
>End Sub
>-------------------

>Regards,

>Elvio Serrao




Sun, 08 Oct 2000 03:00:00 GMT  
 ListView Header Icons

mmm.. there is a way.
use
lv.ImageList = Nothing
then
lv.ImageList = ImageList2
(not completely sure!)

Note: you cannot remove items or clear a ImageList while it is associated with
an control etc. when you remove the referency by 'Nothing' you can free
remove/clear the listview.

see ya.

Quote:
>Robert,

>VB 'reinitializes' the imagelists constantly, so if you use SendMessage to
>attach a different ImageList it will be overruled by VB.
>You could create your own ListBox with API calls, then you can even use the
>system's ImageList.

>Bye

>Richard,

>>I currently have a function which will add an icon to a listview header
>>(arrow up and arrow down). The function will retrieve the icon from a
>>imagelist belonging to the listview. Is there someway I can use the
>>function to reference a different imagelist other than the one
>>associated with the listview?
>>-------------------
>>Public Sub HDShowHeaderIcon(lv As ListView, colNo As Long, imgIconNo As
>>Long, showImage As Long)
>>    Dim lResult                 As Long
>>    Dim hHeader                 As Long
>>    Dim objItem                 As HD_ITEM
>>    Dim imgIcon                 As ImageList

>>    hHeader = SendMessageLong(lv.hwnd, LVM_GETHEADER, 0, 0)
>>    With objItem
>>        .mask = HDI_IMAGE Or HDI_FORMAT
>>        .fmt = HDF_LEFT Or HDF_STRING Or HDF_BITMAP_ON_RIGHT Or
>>showImage
>>        .pszText = lv.ColumnHeaders(colNo + 1).Text
>>        If showImage Then .iImage = imgIconNo
>>    End With
>>    lResult = SendMessage(hHeader, HDM_SETITEM, colNo, objItem)
>>End Sub
>>-------------------

>>Regards,

>>Elvio Serrao




Tue, 10 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Listview header icons

2. Listview Column Header Icon

3. VBNET: Icons in Listview Column Headers

4. icons position in the column header caption in listview

5. listview column header icon

6. icons position in the column header caption in listview

7. ListView Problem with Column Auto-sizing When Headers Use Icons

8. Icons in Listview header

9. Icons in listview header.

10. ListView - Icons in Column Headers

11. Icons in column headers in listviews

12. MouseMove event in ListView does not trigger when ListView in Small/Large Icon View mode

 

 
Powered by phpBB® Forum Software