Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2004, 08:53 PM
Authorized User
 
Join Date: Jul 2003
Location: KL, WP, Malaysia.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hplim18
Default How to put Desc/Asc triangle symbol on List View?

Does anyone know how to put Desc Triangle symbol on List View Column Heading when it is set to have Descending sorting and change to Asc triangle symbol on the list view column heading when it is set to have Ascending sorting?

Thanks a lot in advanced!!!

Jeannie....
__________________
Jeannie....
 
Old May 10th, 2004, 12:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a snipped of the code I use. My icons are in a ImageList (imgList) control.
You can find all the API definitions in the APIViewer. Sorry if did not post the whole thing, it is just a big UserControl that I designed. Call this code anytime the sorting mode changes.

Marco


    Dim hColHeader As Long
    Dim hItem As HDITEM
    Dim k As Long
    Dim bAlignRight As Boolean

    hColHeader = SendMessage(lstData.hwnd, LVM_GETHEADER, 0, 0)
    SendMessage hColHeader, HDM_SETIMAGELIST, 0, ByVal imgList.hImageList

    For k = 0 To lstData.ColumnHeaders.Count - 1
        bAlignRight = (lstData.ColumnHeaders.Item(k + 1).Alignment = lvwColumnRight)
        hItem.mask = HDI_FORMAT Or HDI_IMAGE
        If bAlignRight Then
            hItem.fmt = HDF_STRING Or HDF_RIGHT
        Else
            hItem.fmt = HDF_STRING
        End If
        If k = lstData.SortKey Then
            hItem.fmt = hItem.fmt Or HDF_IMAGE
            If bAlignRight Then hItem.fmt = hItem.fmt Or HDF_BITMAP_ON_RIGHT
        End If
        hItem.iImage = _
            imgList.ListImages(IIf(lstData.SortOrder, cAscending, cDescending)).index - 1
        SendMessage hColHeader, HDM_SETITEM, k, hItem
    Next




Similar Threads
Thread Thread Starter Forum Replies Last Post
put mailto: links on list items in a combo box? webwolf Flash (all versions) 0 September 12th, 2008 08:01 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM
Pascal Triangle mistry_bhavin C++ Programming 2 November 15th, 2005 01:43 AM
list view help anilkumar VS.NET 2002/2003 0 January 22nd, 2004 12:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.