Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:treeview控件宽度

1楼
lur320 发表于:2024/4/13 14:11:00
 如何遍历nodes,然后调整treeview的宽度,确保最右边的node能露出来,底部没有滚动条?
2楼
有点蓝 发表于:2024/4/13 15:40:00
Dim t As WinForm.TreeView = Forms("窗口3").Controls("TreeView1")
t.CollapseAll
t.SelectedNode = t.Nodes(0)
t.ExpandAll
Dim tn As WinForm.TreeNode = t.SelectedNode
Dim level As Integer = 0
For Each n As WinForm.TreeNode In t.AllNodes
    If n.Nodes.Count = 0 AndAlso n.Level > level Then
        tn = n
        level = n.Level
    End If 
Next 
Dim trv = t.BaseControl
Dim rg = trv.rectangletoscreen(tn.BaseNode.bounds)
Dim rg2 = Forms("窗口3").panel.rectangletoscreen(trv.bounds)

If rg.Right > rg2.Right Then 
    t.width = rg2.width + rg.Right - rg2.Right + 2
End if

共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02246 s, 2 queries.