listviewgroup troubels
-
Hi, I need some help wilt listviewgroups. 1. How can I find the group that I click/dblclick. I tryed with
Private Sub ListViewCollapsible1_MouseDown(sender As Object, e As MouseEventArgs) Handles ListViewCollapsible1.MouseDown
Dim lv As ListViewCollapsible = sender
Dim lvi As ListViewItem = lv.HitTest(e.X, e.Y).ItemIf lvi Is Nothing Then For n = 0 To (lv.Font.Size \* 2) Dim ht As ListViewHitTestInfo = lv.HitTest(e.X, e.Y + n) If ht.Item IsNot Nothing Then Dim g As ListViewGroup = ht.Item.Group Dim gs As New ListViewGroupState Dim sTag As String = g.Tag & " " If sTag.Contains("collapsed") Then lv.SetGroupState(ListViewGroupState.Normal, ht.Item.Group) ht.Item.Group.Tag = "Collapsed" Else lv.SetGroupState(ListViewGroupState.Collapsed, ht.Item.Group) ht.Item.Group.Tag = "" End If Exit For End If Next End If
End Sub
but when the group is collapsed the code find nothing How can I add an icon to a group? I added an imagelist but groups don't have an imageindex. Jan
-
Hi, I need some help wilt listviewgroups. 1. How can I find the group that I click/dblclick. I tryed with
Private Sub ListViewCollapsible1_MouseDown(sender As Object, e As MouseEventArgs) Handles ListViewCollapsible1.MouseDown
Dim lv As ListViewCollapsible = sender
Dim lvi As ListViewItem = lv.HitTest(e.X, e.Y).ItemIf lvi Is Nothing Then For n = 0 To (lv.Font.Size \* 2) Dim ht As ListViewHitTestInfo = lv.HitTest(e.X, e.Y + n) If ht.Item IsNot Nothing Then Dim g As ListViewGroup = ht.Item.Group Dim gs As New ListViewGroupState Dim sTag As String = g.Tag & " " If sTag.Contains("collapsed") Then lv.SetGroupState(ListViewGroupState.Normal, ht.Item.Group) ht.Item.Group.Tag = "Collapsed" Else lv.SetGroupState(ListViewGroupState.Collapsed, ht.Item.Group) ht.Item.Group.Tag = "" End If Exit For End If Next End If
End Sub
but when the group is collapsed the code find nothing How can I add an icon to a group? I added an imagelist but groups don't have an imageindex. Jan