📄 frmmain.frm
字号:
VERSION 5.00
Object = "{02BEE3A6-4264-45B0-93C8-76FBBA329150}#5.2#0"; "SuperLegend.ocx"
Object = "{A61255F7-0A20-431C-86CE-78C14314BE9E}#5.2#0"; "SuperWkspManager.ocx"
Object = "{03ED3B1E-ED1B-4A2E-8FE3-D8D1A673F5D4}#5.2#0"; "SuperMap.ocx"
Begin VB.Form frmMain
BorderStyle = 3 'Fixed Dialog
Caption = "自定义树范例"
ClientHeight = 5520
ClientLeft = 45
ClientTop = 330
ClientWidth = 8880
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5520
ScaleWidth = 8880
StartUpPosition = 2 'CenterScreen
Begin SuperLegendLib.SuperLegend MyTree
Height = 5295
Left = 0
TabIndex = 3
Top = 120
Width = 2295
_Version = 327682
_ExtentX = 4048
_ExtentY = 9340
_StockProps = 132
End
Begin SuperMapLib.SuperMap SuperMap1
Height = 5295
Left = 2400
TabIndex = 2
Top = 120
Width = 6375
_Version = 327682
_ExtentX = 11245
_ExtentY = 9340
_StockProps = 160
End
Begin SuperMapLib.SuperWorkspace SuperWorkspace1
Left = 2640
Top = 5400
_Version = 327682
_ExtentX = 847
_ExtentY = 847
_StockProps = 0
End
Begin SuperWkspManagerLib.SuperWkspManager SuperWkspManager1
Height = 495
Left = 960
TabIndex = 1
Top = 5040
Visible = 0 'False
Width = 735
_Version = 327682
_ExtentX = 1296
_ExtentY = 873
_StockProps = 0
End
Begin SuperLegendLib.SuperLegend SuperLegend1
Height = 375
Left = 6480
TabIndex = 0
Top = 4320
Visible = 0 'False
Width = 495
_Version = 327682
_ExtentX = 873
_ExtentY = 661
_StockProps = 132
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'=====================================SuperMap Objects示范工程说明=======================================
'
'功能简介:示范如果根据SuperWkspManager、SuperLegend控件来自定义一颗树
'所用控件:SueprMap控件、SuperWorkspace控件、SuperWkspManager控件和SuperLegend控件
'所用数据:..\Data\world\World.sdb和World.sdd两个文件
'操作说明:
' 1、运行后,在MyTree这颗显示的树上可以看到SuperWkspManager和SuperLegend中的
' 节点组合在了一起。
'
'===================================SuperMap Objects示范工程说明结束=====================================
Option Explicit
Private Sub Form_Load()
SuperWkspManager1.Connect SuperWorkspace1.Handle
SuperMap1.Connect SuperWorkspace1.Handle
SuperLegend1.Connect SuperMap1.Handle
SuperWorkspace1.Open App.Path & "\..\data\world\WorldMap.smw"
SuperMap1.OpenMap SuperWorkspace1.Maps(1)
SuperMap1.Refresh
SuperWkspManager1.Refresh
'SuperLegend1.TreeView.Checkboxes = False
SuperLegend1.Refresh
'开始组合自己的树
'先搞定imagelist
MyTree.TreeView.ImageList.CopyFrom SuperWkspManager1.TreeView(1).ImageList, 1, SuperWkspManager1.TreeView(1).ImageList.Count
MyTree.TreeView.ImageList.CopyFrom SuperLegend1.TreeView.ImageList, 1, SuperLegend1.TreeView.ImageList.Count
MyTree.HasLines = True
MyTree.HasButtons = True
MyTree.TreeView.Checkboxes = False
'搞定节点
Dim i As Integer, j As Integer
Dim strName(5) As String
strName(1) = "数据源"
strName(2) = "地图"
strName(3) = "布局"
strName(4) = "三维场景"
strName(5) = "资源"
Dim objNode As New soTreeNode
For i = 1 To 5
objNode.Text = strName(i)
MyTree.TreeView.Nodes.Add objNode
For j = 1 To SuperWkspManager1.TreeView(i).Nodes.Count
MyTree.TreeView.Nodes.Item(i).Nodes.Add SuperWkspManager1.TreeView(i).Nodes.Item(j), True
Next j
Next i
objNode.Text = "图层"
MyTree.TreeView.Nodes.Add objNode
For i = 1 To SuperLegend1.TreeView.Nodes.Count
MyTree.TreeView.Nodes.Item(6).Nodes.Add SuperLegend1.TreeView.Nodes.Item(i), True
Next i
'重新设置一下图层中对应的imagelist,用一下递归
SetLayersImageList MyTree.TreeView.Nodes.Item(6).Nodes, SuperWkspManager1.TreeView(1).ImageList.Count
MyTree.Refresh
End Sub
Sub SetLayersImageList(Nodes As soTreeNodes, nIndex As Integer)
Dim i As Integer
For i = 1 To Nodes.Count
Nodes.Item(i).Image = Nodes.Item(i).Image + nIndex
Nodes.Item(i).SelectedImage = Nodes.Item(i).SelectedImage + nIndex
SetLayersImageList Nodes.Item(i).Nodes, nIndex
Next i
End Sub
Private Sub Form_Unload(Cancel As Integer)
SuperLegend1.Disconnect
SuperMap1.Close
SuperMap1.Disconnect
SuperWkspManager1.Disconnect
SuperWorkspace1.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -