• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Help:Make the 1st col of ListView a TreeView?

I'm trying to simulate a message board similar to that used in the Outlook Express newsreader which has a ListView control with the first column appearing in a TreeView format. Is there a control that does this automatically or is is done manually? Either way, could someone please let
me know where to find the control or how to add the tree structure to the first column?
Any help would be greatly appreciated.
Shi Jun
0
shijun
Asked:
shijun
1 Solution
 
TheAnswerManCommented:
Send me a screen shot of what you are talking about..
Myxlplick@msn.com
0
 
shijunAuthor Commented:
Dear hanzala,
Thank you but I think you may misunderstand or minimize this problem. You can use Outlook Express and look what the news looks like. And the tree view can displayed in any position, as well as in 1st col.If I follow you idea I think I should combine a tree view and some listviews. Thank you any way. Shi Jun

0
 
amebaCommented:
' declarations, in module
Public Type LVITEM
    mask As Long
    iItem As Long
    isubitem As Long
    State As Long
    stateMask As Long
    pszText As String
    cchTextMax As Long
    iImage As Long
    lParam As Long
    iIndent As Long
End Type
Public Const LVM_SETITEM = (LVM_FIRST + 6)
Public Const LVIF_INDENT = &H10&

' in form
' add listview, two columns, and add some items
' in debug window (or commandbutton) try:
' setindent(2,1)
Private Sub SetIndent(ByVal lIndex As Long, ByVal lIndent As Long)
    ' lIndex is 1-based; just pass the ListItem's .Index property
    ' lIndent is the amount of indentation desired; the unit of
    '         measurement is the width of the list item's image.
    Dim LVI As LVITEM
    Dim lRet As Long
    With LVI
       .iItem = lIndex - 1 ' winapi index is 0 based, VB is 1 based
       .mask = LVIF_INDENT
       .iIndent = lIndent
    End With
    lRet = SendMessage(ListView1.hwnd, LVM_SETITEM, 0, LVI)
End Sub


Is this what you want?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now