vb6.0中treeview目录树中怎么加图标
vb6.0中treeview目录树中节点前面怎么加图标例如下面的代码,想在节点前加个图片1.gif:TreeView1.LineStyle=tvwRootLinesDim...
vb6.0中treeview目录树中节点前面怎么加图标
例如下面的代码,想在节点前加个图片1.gif:
TreeView1.LineStyle = tvwRootLines Dim nodX As Node
Set nodX = TreeView1.Nodes.add("teacher", tvwChild, teachername, "教师姓名") 展开
例如下面的代码,想在节点前加个图片1.gif:
TreeView1.LineStyle = tvwRootLines Dim nodX As Node
Set nodX = TreeView1.Nodes.add("teacher", tvwChild, teachername, "教师姓名") 展开
2个回答
展开全部
建一个ImageList控件,右击,属性,在“图像”里插入图片(你的1.gif),看好他们的索引(Index,默认是1)。然后,代码如下。
============
Private Sub Command1_Click()
TreeView1.ImageList = ImageList1 '关联Treeview1与Imagelist1
TreeView1.LineStyle = tvwRootLines
Dim nodX As Node
TreeView1.Nodes.Add , , "a1", "teachername"
Set nodX = TreeView1.Nodes.Add("a1", tvwChild, , "教师姓名", 1) '这个1的意思是刚才设置的图片在ImageList里的索引
End Sub
============
Private Sub Command1_Click()
TreeView1.ImageList = ImageList1 '关联Treeview1与Imagelist1
TreeView1.LineStyle = tvwRootLines
Dim nodX As Node
TreeView1.Nodes.Add , , "a1", "teachername"
Set nodX = TreeView1.Nodes.Add("a1", tvwChild, , "教师姓名", 1) '这个1的意思是刚才设置的图片在ImageList里的索引
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询