以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  Treeview 图标问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=78701)

--  作者:qianqian1530
--  发布时间:2015/12/15 12:42:00
--  Treeview 图标问题
Dim tr As WinForm.TreeView
Dim nd As WinForm.TreeNode
tr = e.Form.Controls("TreeView1")

Dim icons = GetSysicon.GetSysIcon( ProjectPath & "bin" , True)

For Each dir As String In FileSys.GetDirectories(SpecialFolder.DesktopDirectory)
    Dim ifo As New FileInfo(dir)
    nd = Tr.Nodes.Add(ifo.Path & "\\" & ifo.Name,ifo.Name)
    tr.Nodes(0).IconFile = icons 
Next

提示 icon 转换string 无效

--  作者:大红袍
--  发布时间:2015/12/15 14:21:00
--  

Dim tr As WinForm.TreeView
tr = e.Form.Controls("TreeView1")

Dim imgList As New windows.Forms.ImageList
Dim icons = getimage("d:\\test.ico") \'GetSysicon.GetSysIcon( ProjectPath & "bin" , True)
imgList.images.add("bin", icons)
Dim btr = tr.basecontrol
btr.imagelist = imglist

For Each dir As String In FileSys.GetDirectories(SpecialFolder.DesktopDirectory)
    Dim ifo As New FileInfo(dir)
    dim nd = bTr.Nodes.Add(ifo.Path & "\\" & ifo.Name,ifo.Name)
    nd.imageKey = "bin"
Next


--  作者:qianqian1530
--  发布时间:2015/12/15 15:37:00
--  
.NET Framework 版本:2.0.50727.8670
Foxtable 版本:2015.11.11.1
错误所在事件:窗口,地址选择,AfterLoad
详细错误信息:
重载决策失败,因为没有最适合这些参数的 Public“Add”: 
    \'Public Sub Add(key As String, image As System.Drawing.Image)\':
        不是最特定的。
    \'Public Sub Add(key As String, icon As System.Drawing.Icon)\':
        不是最特定的。


--  作者:大红袍
--  发布时间:2015/12/15 15:38:00
--  
 2楼的代码测试没问题啊。
--  作者:大红袍
--  发布时间:2015/12/15 15:45:00
--  

如果报其他错,就这样改

 

Dim tr As WinForm.TreeView
tr = e.Form.Controls("TreeView1")

Dim imgList As New windows.Forms.ImageList
Dim icons = GetSysicon.GetSysIcon( ProjectPath & "bin" , True)
imgList.images.add("bin", icons)
Dim btr = tr.basecontrol
btr.imagelist = imglist

For Each dir As String In FileSys.GetDirectories(SpecialFolder.DesktopDirectory)
    Dim ifo As New FileInfo(dir)
    Dim nd = tr.Nodes.Add(ifo.Path & "\\" & ifo.Name,ifo.Name)
    nd = btr.nodes.Find(nd.name, True)
    nd(0).imageKey = "bin"
Next

 

 

不会做就上传具体例子。