以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于ListView 图标显示的问题 我想用SmallIcon 结果修改了下面的代码就不显示图标了  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=108177)

--  作者:李小胖
--  发布时间:2017/10/17 19:28:00
--  关于ListView 图标显示的问题 我想用SmallIcon 结果修改了下面的代码就不显示图标了
 Dim ct As New Windows.Forms.ListView
            ct.Dock = Windows.Forms.DockStyle.Fill
            ct.Name = "ListView1"
            \'ct.LargeImageList = ImageList  \'这个可以正常显示图标

            ct.SmallImageList = ImageList  \'这个就无法正常显示图标

            e.Form.Controls("Panel1").BaseControl.Controls.Add(ct)
            AddHandler ct.Click, AddressOf QJ_doubleclick


            Dim Multi As String = DataTables("main").GetComboListString("分组名称", "[大类名称] = \'首页\'")
            Dim Values() As String
            Values = Multi.Split("|")
            For Index As Integer = 0 To Values.Length - 1
                Dim s As Windows.Forms.ListViewGroup = New Windows.Forms.ListViewGroup(Values(Index), Windows.Forms.HorizontalAlignment.Center) \'指定的标题文本和指定的标题的对齐方式

                e.Form.Controls("Panel1").BaseControl.Controls("ListView1").Groups.Add(s)
                For Each R As DataRow In DataTables("main").Select(" 分组名称 = \'" & Values(Index) & "\' ")
                    Dim it As New Windows.Forms.ListViewItem

                    it.Text = R("分类名称")
                    it.Group = s
                    it.ImageIndex = R("分类名称") 
                    e.Form.Controls("Panel1").BaseControl.Controls("ListView1").Items.Add(it)
                Next
            Next
[此贴子已经被作者于2017/10/17 19:28:15编辑过]

--  作者:有点甜
--  发布时间:2017/10/17 20:10:00
--  

切换模式

 

ct.View = System.Windows.Forms.View.SmallIcon \'显示模式为小图标


--  作者:李小胖
--  发布时间:2017/10/19 11:35:00
--  
以下是引用李小胖在2017/10/17 19:28:00的发言:
 Dim ct As New Windows.Forms.ListView
            ct.Dock = Windows.Forms.DockStyle.Fill
            ct.Name = "ListView1"
            
ct.View = System.Windows.Forms.View.List \' 如果我使用这个下面就无法分组了
            e.Form.Controls("Panel1").BaseControl.Controls.Add(ct)
            AddHandler ct.Click, AddressOf QJ_doubleclick


            Dim Multi As String = DataTables("main").GetComboListString("分组名称", "[大类名称] = \'首页\'")
            Dim Values() As String
            Values = Multi.Split("|")
            For Index As Integer = 0 To Values.Length - 1
                Dim s As Windows.Forms.ListViewGroup = New Windows.Forms.ListViewGroup(Values(Index), Windows.Forms.HorizontalAlignment.Center) \'指定的标题文本和指定的标题的对齐方式

                e.Form.Controls("Panel1").BaseControl.Controls("ListView1").Groups.Add(s)
                For Each R As DataRow In DataTables("main").Select(" 分组名称 = \'" & Values(Index) & "\' ")
                    Dim it As New Windows.Forms.ListViewItem

                    it.Text = R("分类名称")
                    it.Group = s  \'这里分组没用了,应该怎么修改呢?
                    it.ImageIndex = R("分类名称") 
                    e.Form.Controls("Panel1").BaseControl.Controls("ListView1").Items.Add(it)
                Next
            Next
[此贴子已经被作者于2017/10/17 19:28:15编辑过]


--  作者:有点甜
--  发布时间:2017/10/19 15:04:00
--  
list模式无法实现分组。