以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 目录树插入子节点 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=190854) |
||||
-- 作者:yifan3429 -- 发布时间:2024/3/8 3:53:00 -- 目录树插入子节点 目录树插入子节点求助老师
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/8 8:44:00 --
|
||||
-- 作者:yifan3429 -- 发布时间:2024/3/8 12:15:00 -- Dim tr As WinForm.TreeView Dim nd As WinForm.TreeNode \'Dim id As Integer = nd.index tr = e.Form.Controls("TreeView1") tr.Nodes.Clear() \'清除现有节点 Dim dr As DataRow \'\'\'否则在产品表查找同名的产品行,将找到的行赋值给变量dr dr = DataTables("表B").Find("[角色] = \'BOOS\'") Dim Multi As String = dr("配置") Dim drs As List(Of DataRow) = DataTables("表A").Select("[窗口] in (\'" & Multi.Replace("|", "\',\'") & "\')", "菜单") tr.BuildTree("", "", "", "商务管理,销售管理,供应管理") 希望按照 商务管理,销售管理,供应管理 顺序控制排列 此主题相关图片如下:企业微信截图 下面是随机排序 For Each drn As DataRow In drs If tr.Nodes.Contains(drn("菜单")) Then nd = tr.Nodes(drn("菜单")) Else nd = Tr.Nodes.Add(drn("菜单"), drn("菜单")) nd.ForeColor = Color.Red \'希望子节点按照表A的归属插入到一级节点下 End If nd.Nodes.Add(drn("窗口"), drn("窗口")) Next
[此贴子已经被作者于2024/3/8 12:15:20编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/8 13:37:00 -- 表A增加一个排序列,select查询的时候按照这个列排序 |
||||
-- 作者:yifan3429 -- 发布时间:2024/4/2 20:19:00 -- Dim e = args(0) Select Case MainTable.name Case "导航" If e.Node.Level = 0 Then Dim Pa As WinForm.Panel Pa = Forms("菜单_工作台").CreateControl("lable1", ControlTypeEnum.Panel) Pa.Name = "Pa" Pa.Width = 500 Pa.Height = 270 Pa.Left = (Forms("菜单_工作台").Width - Pa.Width) / 2 Pa.Top = (Forms("菜单_工作台").Height - Pa.Height) / 2 Pa.BackColor = Color.Wheat Forms("菜单_工作台").AddControl(Pa) Dim dr As DataRow \'\'\'否则在产品表查找同名的产品行,将找到的行赋值给变量dr\'\'\' If User.Type = UserTypeEnum.Developer Then \'只有开发者才加载表C Forms("目录树").Controls("Button1").Text = "开发者 _ 目录" dr = Rolesdt.SQLFind("[角色名称] = \'开发者\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing Dim zcdd As WinForm.Button Dim Multi As String = dr("布局_PC功能") Dim newMulti As String = "(\'" & Multi.Replace("|", "\',\'") & "\')" Dim drs As List(Of DataRow) = cdwdt.Select("[主窗] in " & newMulti, "菜单排序") For Each drn As DataRow In drs Dim Value As String = drn("布局_PC功能") Dim sps() As Char = {"|"} Dim Names() As String = Value.Split(sps) Dim s As Integer = 2 Dim t As Integer = 5 For i As Integer = 0 To Names.length - 1 If i <> 0 Then If i Mod 10 = 0 Then s = 2 t = t + 81.9 Else s = s + 72.9 End If End If Dim nm As String = Names(i) zcdd = e.Form.CreateControl(nm, ControlTypeEnum.Button) \' zcdd.Theme = "(none)" \'去掉原来的样式 zcdd.Font = New Font("宋体", 9, FontStyle.Regular) zcdd.Text = nm & vbcrlf & "***" & vbcrlf & "条" zcdd.name = nm zcdd.Width = 72 zcdd.Height = 81 zcdd.Left = s + 8 zcdd.Top = t + 2 zcdd.BorderSize = 0 Forms("菜单_工作台").Controls("Pa").AddControl(zcdd) zcdd.ToolTip = zcdd.Text \'动态提示 Next Next End If End If Else End If End Select 还是目录树的原理 想用Button控件显示 请教老师 怎么做
[此贴子已经被作者于2024/4/2 20:33:29编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/4/2 20:23:00 -- 没看懂,截图说明一下 |
||||
-- 作者:yifan3429 -- 发布时间:2024/4/2 20:34:00 -- 如图 原来用节点显示的数据 现在想用按钮显示
[此贴子已经被作者于2024/4/2 20:38:20编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/4/2 20:47:00 -- 不就是i这种用法吗:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=190802&skin=0 |
||||
-- 作者:yifan3429 -- 发布时间:2024/4/2 20:55:00 -- 案例 [此贴子已经被作者于2024/4/2 20:55:27编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/4/2 21:06:00 -- If e.Node.Level = 0 Then Forms("菜单按钮").Show 添加按钮的代码比如 zcdd = e.Form.CreateControl(dr("窗口"), ControlTypeEnum.Button) …… next end if
|