您的位置:程序门 -> vb -> 控件



treeview 问题!!!!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


treeview 问题!!!!![已结贴,结贴人:gis_yifan]
发表于:2007-05-25 17:27:54 楼主
以前没有用过vb,现在要用vb   做个控件,有个父节点aa,下面有两个子节点bb,cc。右击这两个子节点时弹出一个菜单,菜单中有:“可编辑”,“可选择”两个选项,时间比较急,请各位给点简要的代码,谢谢了。
发表于:2007-05-25 17:34:271楼 得分:10
代码就没有,只说一下大概方法吧
先做一个菜单,隐藏的那种弹出菜单
然后在此子节点的mouse_click事件那里触发,显示出菜单.
发表于:2007-05-25 17:43:282楼 得分:10
private   sub   treeview1_mouseup(button   as   integer,   shift   as   integer,   x   as   single,   y   as   single)
       
        dim   nodx         as   node
       
        if   button   =   vbrightbutton   then
               
                set   nodx   =   treeview1.hittest(x,   y)
               
                if   not   nodx   is   nothing   then
                        if   not   nodx.parent   is   nothing   then
                                popupmenu   yourmenu
                        end   if
                end   if
               
        end   if
       
end   sub
发表于:2007-05-25 17:44:563楼 得分:0
自己的需要都没说清。
发表于:2007-05-25 17:51:544楼 得分:10
http://download.csdn.net/source/183738
这里有一个就是treeview点右件弹出菜单“重命名”
代码很简单不像楼上那么复杂,我的就这一句
选择右键一样,根本不用什么hit
private   sub   treeviewfolder_mouseup(button   as   integer,   shift   as   integer,   x   as   single,   y   as   single)
          if   button   =   2   then   popupmenu   mmenufolder
end   sub
右边是listview和资源管理器一样
发表于:2007-05-25 17:55:195楼 得分:0
只要按鼠标他就有选择
这又不是vb的dirlistbox多此一举。


快速检索

最新资讯
热门点击