文档库 最新最全的文档下载
当前位置:文档库 › An Efficient Implementation of Tree-based Multicast Routing for Distributed Shared-Memory M

An Efficient Implementation of Tree-based Multicast Routing for Distributed Shared-Memory M

An Efficient Implementation of Tree-based Multicast Routing for Distributed Shared-Memory M
An Efficient Implementation of Tree-based Multicast Routing for Distributed Shared-Memory M

An Ef?cient Implementation of Tree-Based Multicast Routing for Distributed

Shared-Memory Multiprocessors

M.P.Malumbres and Jos′e Duato

Departamento DISCA

Universidad Polit′e cnica de V alencia Camino de V era s/n,46071V alencia,Spain jduato,mperez@gap.upv.es

Josep Torrellas

CSRD

University of Illinois at Urbana-Champaign 1308West Main Street,Urbana,IL61801

torrella@https://www.wendangku.net/doc/bb10940229.html,

Abstract

This paper presents an ef?cient routing and?ow control mechanism to implement multidestination message passing in wormhole networks.It is targeted to situations where the size of message data is very small,like in invalidation and update messages in distributed shared-memory multipro-cessors(DSMs)with hardware cache coherence.The mech-anism is a variation of tree-based multicast with pruning to avoid deadlocks.The new scheme does not require that the destination addresses in a given multicast message be ordered,thereby avoiding any ordering overhead.It al-lows messages to use any deadlock-free routing function and only requires one startup for each multicast message.The new scheme has been evaluated on several k-ary n-cube networks under synthetic loads.The results show that the proposed scheme is faster than other multicast mechanisms when the multicast traf?c is composed of short messages.

1.Introduction

The performance of scalable multiprocessors is often de-termined by how effectively they support processor com-munication.Multicast communications routinely appear in parallel programs.Typical examples include explicit distri-bution of data to several nodes or invalidation and update messages in distributed shared-memory multiprocessors[2] (DSMs).Similarly,many-to-one messages are also com-mon.Examples include barrier synchronization and global reductions.It appears,therefore,that optimizing the mul-ticast operation would improve the performance of scalable multiprocessors.

Ef?cient support for multicast has been the subject of much previous research.Deadlock-freedom was studied for multicast communications in multicomputer networks us-ing wormhole switching in[3,6].Multicast messages are propagated following a few paths that visit all destinations

The rest of this paper is organized as follows:Section 2describes the new multicast mechanism;Section3ana-lyses deadlock avoidance;Section4evaluates the scheme and compares it to other schemes;and Section5presents conclusions and future work.

2.Tree-Based Multicast with Pruning.

Tree-based multicast has traditionally been considered a good mechanism for broadcast and multicast in store-and-forward networks.However,with the arrival of wormhole switching,it became very prone to deadlock.As a con-sequence,other multidestination routing mechanisms like path-based multicast have been studied.However,we have reconsidered tree-based multicast,in order to accomodate it to wormhole switching and overcome some inef?ciencies of path-based when DSM networks are considered.

The operation of the new tree-based multicast mechan-ism is similar to the traditional one in some respects.In a multicast message,each address?it is routed at all inter-mediate nodes.These nodes decide the best path to follow. They can open a new path if the paths reserved by address ?its already processed are not good.Therefore,a multicast message will be able to expand as many branches as needed in its advance toward the destinations.

One of the differences of our scheme is the way in which we organize the information in a message.Figure1shows the format of a multicast

message.

Figure1.Message format for tree-based mul-

ticast with pruning.

For our scheme to work correctly,data?its must be stored in an auxiliary buffer at each intermediate node,even if it is not a destination.So,we need to add a new auxiliary buffer to store a copy of the data?its.This buffer is associated with every input channel of every node.When the?rst address ?it of a message arrives at an intermediate node,the follow-ing data?its are copied to the corresponding auxiliary buf-fer.It stores the data until the tail of the message leaves the node.Thus,when a destination address?it,where, is routed at a node,two things may happen:

If opens a new path at node,that is,it does

not follow any path previously established by destin-

ation addresses,...,in the same message,then

node must inject the data?its after transmitting.

Thus,establishes a new branch in the multicast tree.

If decides to use a path previously established by (with)in the same message,then it crosses node following that path.Data?its are not injec-

ted after transmitting,because they were sent after

transmitting the destination address?it.

P

d1data d2d3d4d5

d1data

data

d2d4

d3d5

A

A’’

A’

to d1,d2,d4

to d3,d5

A’

A’

A

A

A’’

A’’

Figure2.A multicast branching example:The

original multicast worm,A,is divided into two

worms,A’and A”,at node

P.

Channel reserved by message A

Source node for message B

Labelled flit

Channel reserved by message B.

Source node for message A

Figure3.A deadlock between two multicast

messages A and B.

It is important to note that the message format remains the same during the advance of the multicast worm.For each new branch,a”new”multicast message is expanded on-the-?y with the same format as the original one.Figure2shows an example of multicast worm propagation.

3.Deadlock Recovery in Tree-Based Multicast

with Pruning.

We propose solving deadlocks and contention by con-trolling multicast rami?cations through a pruning mechan-ism.When one of the branches of a multicast message is blocked at a given node,a pruning of all the other branches of the message is performed at that node.As?ow control stops?its in previous nodes,pruning is also performed at those nodes.Then,the pruned branches can freely advance and release channels that could block other messages.

For example,?gure3shows a deadlock on2D-mesh using XY routing where two multicast worms block each other.Message A has three destinations:,and. Message B has?ve destinations:.The?rst ad-dress?it of A,,crossed Q and P and reached its destina-tion.The?rst address?it of B,,also reached its destina-tion crossing nodes T and Q.The deadlock state is reached when the destination address?its of each message,and ,can not advance because the other message is using the requested channel.The requested channels are indicated by arrows in?gure3.

To recover form deadlock,the pruning mechanism is used at nodes Q and T.When node Q routes and?nds that there is no free output channel for it,a pruning of all the other branches of message A is performed at this node. In this case,the branch opened by is pruned,so that it can freely advance toward its destination.When node T routes and?nds that there is no space in the selected output chan-nel then the branch destined for will be pruned.This prun-ing is redundant but shows that nodes performing a pruning do not need to synchronize.

The described pruning mechanism is able to recover from deadlocks produced as a consequence of using tree-based multicast,assuming that the routing function for unicast messages is deadlock-free.

4.Evaluation.

We have developed a?it-level simulator of interconnec-

tion networks that supports unicast routing,path-based mul-ticast routing and tree-based multicast routing with prun-ing.In our experiments,we run several simulations to ana-lyze the behavior of tree-based multicast routing against unicast routing and path-based multicast routing algorithms like Dual-Path[6]and PM[4].

All multicast messages have one data?it,a typical data size for invalidation messages in distributed shared-memory multiprocessors.The number of destinationsof each multic-ast message varies between4and25.A uniform distribu-tion is used to construct the destination set of each multicast message.Deterministic routing algorithms are used for tree-based multicast and unicast in all the simulations.The rout-ing algorithms for Dual-Path and PM have been described in [6,4].In the multicast experiments of section4.2traf?c con-sists of multicast messages only.In section4.3we present simulations with a traf?c pattern composed of unicast and multicast messages.

In all simulations,we have assumed that each physical channel has a bandwidth of one?it per clock cycle.Fur-thermore,both the switch and the routing circuit require one clock cycle to process a?it.In section4.2,each router has four injection and delivery channels.Multiple delivery channels are required to avoid deadlock in path-based mul-ticast algorithms[7].However,in section4.3each router has only one injection channel and one delivery channel. Each physical channel has queues with capacity for two?its at each end and one auxiliary queue at the input side with capacity for one?it.

20

40

60

80

100

120

140

160

180

200

0.0050.010.0150.020.0250.030.0350.040.045

A

v

e

r

a

g

e

M

e

s

s

a

g

e

L

a

t

e

n

c

y

(

C

y

c

l

e

s

)

Traffic (Flits/Cycle/Node)

’PM-Mcast.11’

’Dual-P-Mcast.11’

’Unicast.11’

’Tree-Mcast.11’

20

40

60

80

100

120

140

160

180

200

0.0050.010.0150.020.0250.030.0350.040.045

Traffic (Flits/Cycle/Node)

A

v

e

r

a

g

e

M

e

s

s

a

g

e

L

a

t

e

n

c

y

(

C

y

c

l

e

s

)

’Dual-P-Mcast.4’

’PM-Mcast.4’

’Unicast.4’

’Tree-Mcast.4’

https://www.wendangku.net/doc/bb10940229.html,parative evaluation of different

multicast mechanisms for an8x82D-mesh.

In this section,we compare different multicast schemes on an8x82D-mesh topology,using the simulation paramet-ers presented above.We compare our tree-based mechan-ism to two path-based schemes,namely the Dual-Path and the PM routing algorithm.In addition,we include the uni-cast mechanism as a reference.

We note that the startup time and the time needed to gen-erate multicast messages in path-based multicast schemes, have not been considered when computing the network latency.If we included such time,the Dual-Path and PM schemes would increase their latency by the amount of cycles required to perform the message preparation phase of each message.Also,Dual-Path will usually need two star-tups for each message and unicast will need startups,being the number of message destinations.Therefore,the results presented in this section for the Dual-Path,PM and unicast algorithms are optimistic.

Figure4shows the average message latency for the dif-ferent multicast mechanisms using traf?c composed of mul-ticast messages with4and11destinations.The measure-ments are performed for different traf?c loads.Each curve has a label that indicates the associated multicast mechanism and the number of destinations of each message.

The PM algorithm(PM-Mcast in?gure4)has a higher latency than the other algorithms for traf?c conditions be-

0204060801001201401601802000.01

0.02

0.03

0.04

0.05

0.06

Traffic (Flits/Cycle/Node)

’Unicast.25’

’Tree-Mcast.25’

’Unicast.18’’Tree-Mcast.18’

A v e r a g e M e s s a g e L a t e n c y (C y c l e s )

0204060801001201401600.010.02

0.03

0.04

0.05

0.06

0.07

Traffic (Flits/Cycle/Node)

A v e r a g e M e s s a g e L a t e n c y (C y c l e s )

’Tree-Mcast.4’

’Tree-Mcast.11’

’Unicast.4’’Unicast.11’

Figure 5.Tree-based multicast versus unicast in an 8x82D-mesh with mixed traf?c.

low saturation.The Dual-Path algorithm achieves better results than the PM algorithm when the number of destin-ations grows.However,it reaches the saturation point very quickly if we compare it to unicast (Unicast in the ?gures)and the tree-based mechanism (Tree-Mcast in the ?gures).Finally,we can see that tree-based multicast routing per-forms much better than path-based multicast routing for all traf?c loads and number of destinations,even without con-sidering the message preparation latency.Therefore,we now focus on comparing our scheme to unicast routing.

In order to obtain a more realistic view of the behavior

of tree-based multicast,we analyzed the performance using mixed traf?c consisting of unicast and multicast messages.However,we did not consider the startup latency.Note that this latency is constant for tree-based multicast but increases linearly with the number of destinations for unicast.

In ?gure 5,we show the average message latency of tree-based multicast and unicast routing.The traf?c pattern con-sists of a 40%of unicast messages with 8data ?its per mes-sage and a 60%of multicast messages with one data ?it.This pattern may be representative of the traf?c in a dis-tributed shared-memory multiprocessor where updates and invalidations produce multicast messages and cache misses are served by unicast messages,each one containing a cache

line (8data ?its).

From ?gure 5,we can see that,under this load,tree-based multicast still behaves much better than unicast routing.So,we expect the new multicast scheme to have a good behavior under real traf?c.

5.Conclusions and Future Work.

This paper has presented a fast multicast ?ow control mechanism for wormhole networks.The advantages of the new scheme are that multicast messages do not need a pre-processing step that orders the destinations,only require one start-up,reach the destinations following minimal paths if the base routing algorithm is minimal,work for any topo-logy,and can use the routing algorithm of unicast messages.We call the new scheme tree-based multicast with branch pruning.The new scheme is deadlock-free and is particu-larly ef?cient for short messages,like those used to transfer invalidations and updates in DSMs.

We have presented a preliminary evaluation of the new scheme with simulations of synthetic multicast loads.Mul-ticast messages routed with the new scheme have signi?c-antly lower latency than if they are routed with state-of-the-art path-based schemes.Furthermore,for high traf?c,the network has substantially higher throughput.We also show that tree-based multicast with branch pruning is better than unicast,even when startup latency is not considered.

We plan to use SPLASH2multiprocessor applications with multicast invalidation and update messages and a de-tailed simulation model of a DSM multiprocessor to evalu-ate the impact of the proposed scheme on overall execution time.We also plan to study ef?cient many-to-one commu-nication schemes in order to develop a better support for ac-knowledgment messages in DSMs.

References

[1]J.Duato,A new theory of deadlock-free adaptive routing in

wormhole networks,IEEE Trans.Parallel Distributed Syst.,vol.4,no.12,pp.1320–1331,Dec.1993.

[2] D.Lenoski,https://www.wendangku.net/doc/bb10940229.html,udon et al,The Stanford DASH multipro-cessor,IEEE Computer ,25(3):63-79,March 1992.

[3]X.Lin and L.M.Ni,Deadlock-free multicast wormhole rout-ing in multicomputer networks,in Proc.18th https://www.wendangku.net/doc/bb10940229.html,put.Architecture ,May 1991.

[4]X.Lin,P.K.McKinley and A.H Esfahanian.Adaptive mul-ticast wormhole routing in 2D-mesh multicomputers,in Proc.Parallel Architectures Lang.Europe 93,June 1993.[5]X.Lin,P.K.McKinley and L.M.Ni.The message?ow model

for routing in wormhole-routed networks,in Proc.1993Int.Conf.Parallel Processing ,Aug.1993.

[6]X.Lin,P.K.McKinley and L.M.Ni,Performance evaluation

of multicast wormhole routing,in Proc.Int.Conf.Parallel Processing ,I:435-442,1991.

[7] D.K.Panda,S.Singal and P.Prabhakaran.Multidestination

message passing mechanism conforming to base wormhole routing scheme,in Proc.of the Parallel Computer Routing and Communication Workshop ,pages 131-145,1994.

Access Treeview 应用实例

《Access Treeview 应用实例》 使用说明: 本程序可在各种支持VBA语言的软件上直接使用,其中MS Access已成功测试具体步骤为: 1、在Access里创建一个tblTreeview的数据表如下图: 2、在Access里创建一个frmTreeview的窗体,在窗体里创建一个Treeview1的Treeview控件和一个 ImageList1的ImageList控件如下图:

3、然后把程序复制到frmTreeview窗体的加载事件当中如下图: 4、最终效果如下图:

程序: Private Sub Form_Load() On Error Resume Next Dim strParent As String, strChild As String, MyNode As Node Me.Treeview1.Nodes.Clear '清除Treeview的所有旧节点 Me.Treeview1.ImageList =Me.ImageList1.Object '把图标加载到每个节点前面 Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblTreeview", dbOpenSnapshot, dbReadOnly) 'Treeview 节点数据来源 While Not rst.EOF strChild = rst!ChildID If rst!ChildID <> rst!ParentID Then strParent = Mid(rst!ParentID, 1, Len(rst!ParentID) - Len(rst!ChildID) - 1) Set MyNode = Me.Treeview1.Nodes.Add(strParent, tvwChild, rst!ParentID, rst!ChildID, "A1", "A3") '加载子节点 Else strParent = rst!ChildID Set MyNode = Me.Treeview1.Nodes.Add(, , strChild, rst!ChildID, "A1", "A3") '加载父节点End If rst.MoveNext Wend rst.Close '关闭数据集 Me.Treeview1.HideSelection = False '离开焦点后有阴影 End Sub

VB控件 treeview用法详解

VB TreeView控件使用详解 (2012-06-16 15:08:16) 标签:分类: 第一小时:学习直接用代码将数据填充到树控件中。 为什么要先学习直接用代码将数据填充到树控件中因为这种方法是最简单的,代码也最容易理解,学习树控件,先将这个学会,已经掌握了一半,所以先不要急着想怎么将表中的数据填充到树控件中,在第一小时里,树控件和表完全没有关系。 目的:我们要在树控件中建立如下的一个3层级关系 水果 | |__苹果 | |__红富士 | |__国光 | |__葡萄 |__红提子 |__青提子 解释:水果包含2种,一种是苹果,一种是葡萄,苹果又包含2种,一种是红富士,一种是国光,葡萄也如此。 在这里:“爷”是水果,“父”是苹果,葡萄,“子”是红富士,国光,红提子,青提子。概括如下: 爷(只能有一个):水果 父(这里有2个):父1:苹果;父2:葡萄

子(这里有4个):子1:红富士(父1苹果的子);子2:国光(父1苹果的子);子3:红提子(父2葡萄的子);子4:青提子(父2葡萄的子) 1、新建一个窗体,在窗体上放置两个控件,一个是Treeview,一个是Imagelist 如何找到这两个控件 Treeview控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Treeview Control,Version " Imagelist控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Imagelist Control,Version " Treeview控件大家都明白干什么用的,Imagelist控件是干什么用呢原来这个控件是放图标用的,如果你想在树控件中显示图标的,这个图标都将储存在ImageList控件中。 2、设置这两个控件的属性 首先要讲清楚控件的属性设置有2种,一种是设置这个控件在ACCESS中的属性,比如名称等。一种是设置这个控件本身的属性。要设置这个控件在ACCESS中的属性,选中控件后按鼠标右键选“属性”就可以了。跟我们平时设置文本框什么的一样。要设置这个控件本身的属性,只要双击这个控件就可以了。 1)设置Treeview控件在ACCESS中的名称属性,将名称设置为“Treeview" 2)设置Imagelist控件在ACCESS中的名称属性,将名称设置为“Image" 2)设置Imagelist控件本身的属性,双击控件后,在弹出来的设置框中选“Images",单击“Insert Picture"按钮,在你电脑中选择你需要的图标。在“Key:”栏中填入“K1”。其他默认设置不用改。3)设置Treeview控件本身的属性,双击控件后,在弹出来的设置框中选“General”,在这个选项面版中有很多项设置,大多数是设置树控件的显示格式,你自己慢慢研究。这里我们将第一项“Style"选7,在第五项“Imagelist"选项中将我们放置的Imagelist控件“Image"选上。这项设置就将图标和树控件联系了起来。 3、写代码将数据填充到树控件中

treeview控件应用

树形结构控件TreeView TreeView是一种 能以树形目录结构形式 显示数据的高级控件, 显示方式类似于 Windows的资源管理 器,能分层展开各结点 的子目录,也能收缩各 结点的子目录。本节将 先介绍TreeView控件 的一些基本概念、属性 与方法,再举例说明 TreeView控件的应用。 TreeView控件概述、属性与方法 1、作用:用于显示Node结点的分层列表。 2、添加到控件箱 菜单命令:工程 | 部件,在部件对话框中选择:Microsoft Windows Common Controls 6.0 3、TreeView控件的属性 (1)属性对话框 用鼠标右键单击TreeView 控件,在弹出式菜单中选择属 性,进入属性设置对话框,该 对话框分为通用、字体、图片 三个选项卡,如图8.6所示。

①样式(Style):返回或设置在Node结点之间显示的线样式,如表8.6所示。 ②鼠标指针(MousePoint):可选择不同鼠标样式,如表8.1所示。 ③线条样式(LineStyle):0-tvwTreeLine 无根结点的树形结构,1-tvwRootLines有根结点的树形结构。 ④标签编辑(LabelEdit):0-tvwAutomatic 自动,1-tvwManual 手工; ⑤图像列表(ImageList):结点图标所用ImageList控件; ⑥边框样式(BorderStyle):0-ccNone无边框,1-ccFixedSingle单边框; ⑦外观(Appearence):0-ccFlat平面效果,1-cc3D 3D效果; ⑧缩进:父子结点的水平间距。 (2)其它属性 ①SelectedItem.Text属性:用于返回或设置当前Node结点的内容。 ②CheckBoxes属性:该属性只能取逻辑值,若取True值,则每个Node结点前出现一个复选框,否则不出现复选框。 4、TreeView控件的方法 (1)Node结点 ①Node结点:是TreeView控件中的一项,它包含图像与文本。 ②Nodes结点集合:包含一个或多个Node结点。 (2)Add方法 ①作用:为TreeView控件添加节点和子节点。 ②定义格式 TreeView1.nodes.Add(Relative,Relationship,Key,Text, Image,SelectedImage) 其中: ◆Relative参数:添加新结点时,其父结点键值Key。添加根结点时,此项为空。 ◆Relationship参数:新结点的相对位置: tvwlast—1:新节点位于同级别所有节点之后; tvwNext—2:新节点位于当前节点之后; tvwPrevious—3:新节点位于当前节点之前; tvwChild—4:新节点成为当前节点的子节点。 ◆Key:Node结点关键字(唯一标识符),用于检索Node结点。同时也作为其新建子结点的Relative值,即新建子结点的Relative=父结点Key。 ◆Text:Node结点文本。 ◆Image:Node结点位图,是关联ImageList控件中位图的索引。

delphi中TreeView控件使用

DELPHI中利用TreeView控件建立目录树2000-06-26 00:00:00·-·中国计算机报社 p>Rainbow的话:关于TreeView的使用,还可以参看:联合使用TreeView 组件 TreeView是一个显示树型结构的控件,通过它能够方便地管理和显示具有层次结构的信息,是Windows应用程序的基本控件之一。DELPHI虽然具有比较强大的文件管理功能,提供了多个用于文件管理的标准控件,如DriveComboBox、DirectoryListBox、FileListBox等,通过设置它们的属性,使其建立起联系,甚至不用编写一行程序,我们就可以实现在不同的目录之间进行切换,然而这样的目录切换只适用于进行文件的查找定位,而不能方便地进行目录的浏览,例如我们要从c:\windows目录转到c:\program files目录,就必须返回到根目录才能进行切换,而不能象Windows资源管理器那样任意地在不同的目录之间进行浏览与切换。 要实现在不同目录之间任意切换和浏览,还是需要使用TreeView控件,以下程序就利用DELPHI的TreeView控件来建立目录树。 在该程序中采用的各部件以及界面设计如下图所示: 各部件的主要属性设置如下: 部件属性属性值form name caption form1 ‘目录浏览’ drivecommbobox name visible drivecommbobox1 false filelistbox name visible filetype filelistbox1 false fddirectory imagelist name imagelist1 treeview name images 该程序利用DriveCommboBox控件来获得系统具有的驱动器,并以此作为目录树的最上层,利用FileListBox控件,通过设置其Filetype属性为fdDirectory,可以获得所需的子目录,在TreeView控件的OnExpanding事件中将得到的子目录加到该控件的某一节点下。

C_-TreeView控件使用方法

TreeView 控件显示Node 对象的分层列表,每个Node 对象均由一个标签和一个可选的位图组成。 本文主要介绍C# treeView控件中,添加,修改、删除节点等c# treeview控件的使用方法。 其代码如下: 1.private void Form1_Load(object sender, EventArgs e) 2.{ 3. https://www.wendangku.net/doc/bb10940229.html,belEdit = true;//可编辑状态。 4. 5.,这个结点是根节点。 6. TreeNode node = new TreeNode(); 7. node.Text = "hope"; 8. treeView1.Nodes.Add(node); 9. TreeNode node1 = new TreeNode(); 10. node1.Text = "hopeone"; 11. TreeNode node11 = new TreeNode(); 12. node11.Text = "hopeoneone"; 13. TreeNode node2 = new TreeNode(); 14. node2.Text = "hopetwo"; 15. node1.Nodes.Add(node11);//在node1下面在添加一个结点。 16. node.Nodes.Add(node1);//node下的两个子节点。 17. node.Nodes.Add(node2); 18. 19. TreeNode t = new TreeNode("basil");//作为根节点。 20. treeView1.Nodes.Add(t); 21. TreeNode t1 = new TreeNode("basilone"); 22. t.Nodes.Add(t1);

Treeview 控件的简单应用

Treeview 控件的简单应用: 在VB中Treeview 控件的添加: 通过VB菜单,[工程] -- [部件],然后勾选Microsoft Windows Common Controls 6.0 (SP6),[确定]。 在工具箱里就有了Treeview 控件的图标。 Treeview 控件具有显示类似目录层次结构的格式,在具体应用中很有实际意义。下面简单介绍。 一.在Treeview 控件中添加1个新节点: 在Treeview 控件中添加1个新节点,是通过Treeview 控件的Nodes 集合的Add方法添加一个Node 对象来实现的。 使用方法: Dim nodX As Node Set nodX = Treeview1.Nodes.Add(relative, relationship, key, text, image, selectedimage) 其中参数说明: Relative:可选的。已存在的Node 对象的索引号或键值。新节点与已存在的节点间的关系,可在下一个参数relationship 中找到。可以这样理解relative的作用,是新节点的位置的参照对象。 Relationship:可选的。指定的Node 对象的相对位置,如设置值中所述。本参数是相对参数relative而言。 Key:可选的。唯一的字符串,可用于用Item 方法检索Node。 Text:必需的。在Node 中出现的字符串。 Image:可选的。在关联的ImageList 控件中的图像的索引。 Selectedimage:可选的。在关联的ImageList 控件中的图像的索引,在Node 被选中时显示。 以上参数image和selectedimage,是设置节点文字左边的图形,以后详细举例说明。 例1: Set nodX = TreeView1.Nodes.Add(, , "R", "Root") 这是缺省了relative, relationship, image, selectedimage参数的实例,而key值用“R”,text 值用“Root”。 通常,缺省了relative, relationship的节点,是第1层节点。本例,生成了一个第1层节点,显示的文字为“Root”。 例2: Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C1", "Child 1") nodX.EnsureVisible '这个方法EnsureVisible,使得新添加的子节点后,展开多层显示。 本例:relative为“R”,relationship为tvwChild,key为“C1”,text为“Child 1” 其功能是:建立1个新节点;该新节点是节点key值为“R”的子节点(tvwChild),而该新节点的key值用“C1”,text值用“Child 1”。 我们现在要为TreeView1控件添加新节点,可能有三种情况; 1)添加1个新的第1层节点。 Set nodX = TreeView1.Nodes.Add(, , "R1", "Root1")

ACCESS Treeview控件(树型控件)快速入门

Access 2003:Treeview控件(树型控件)快速入门(2010-06-01 14:26:08) 很多东西看起来很复杂,其实学起来还是蛮简单的。说这样的话不是“站着说话不腰疼”,而是切切实实的感受。很多时候我们会感到恍然大悟,之后便轻车熟路,信手拈来了,这就是前面所说的感觉,正所谓“山重水复疑无路,柳暗花明又一村”。 学这个Treeview控件也是一样。看起来它那么复杂,解释起来连篇累牍,但是我们需要的却往往只是其中一点,然后不断的重复使用这一点,仅仅这样,就能解决不少实际的问题。 使用Treeview的优点很多,比如具有无限扩展性,一个一个的分支,分支下面又可以增加次一级分支,每级分支又可以有很多并列的分支,这样就能满足多样的需求,另外,它还有很好的组织管理性,因为它具有明显的层级关系,很多人会用TreeView来做物料BOM表,可以说把这种特性发挥的淋漓尽致。 建立下面这样一个Treeview并不难,你只需要使用一句代码,多写几次就OK了。 不妨来看看代码,不过不用怕,记住,这里只有一句代码,其它的都在重复! Dim ndeindex As Node Set ndeindex = TreeView0.Nodes.Add(, , "a", "基础资料", "k1")

Set ndeindex = TreeView0.Nodes.Add("a", tvwChild, "a1", "品号资料维护", "k1") Set ndeindex = TreeView0.Nodes.Add(, , "b", "工时资料", "k1") Set ndeindex = TreeView0.Nodes.Add("b", tvwChild, "b1", "观测资料查询", "k1") Set ndeindex = TreeView0.Nodes.Add("b", tvwChild, "b2", "工时查询(依品号)", "k1") Set ndeindex = TreeView0.Nodes.Add("b", tvwChild, "b3", "工时查询(依其它条件)", "k1") Set ndeindex = TreeView0.Nodes.Add(, , "c", "产能模式", "k1") Set ndeindex = TreeView0.Nodes.Add("c", tvwChild, "c1", "FCST产能计算", "k1") Set ndeindex = TreeView0.Nodes.Add("c", tvwChild, "c2", "产能试算", "k1") Set ndeindex = TreeView0.Nodes.Add(, , "d", "成本模式", "k1") 所以,不用太多解释,你应该明白这个函数的参数的意思了吧?第一个参数是指它从属的上级,如果它就是顶级,那就空着;第二个参数表示当前这个是前面的那个上级的下一级,这是系统规定的,照抄就行;第三个参数是当前级别的代号;第四个参数就是当前级别的显示文字,想看到什么就写什么;最后一个是指当前级别前面的图,这个在imagelist控件中,如果你要用,就加这个控件,不用也行,就把这个参数空着。(如果要用,需要现在imagelist中插入图像,然后再treeview中指定使用这个imagelist,k1是在插入图像时指定的图像代号。如下图所示)

delphi中treeview的使用

delphi中Treeview的使用介绍 每一个节点下子节点形成这一节点的Items属性,当前节点有一个唯一的Index(TreeNode的Index属性),用于说明子节点在Items 中的位置,每一个节点下的子节点是顺序编号的,第一个是0,第二个是1,依次类推。用IndexOf方法获得子节点的顺序,绝对顺序(AbsoluteIndex)则是指从Treeview第一个项开始的顺序值,第一个是0,如此推下去。Item属性则根据Index的值返回当前节点的第Index个子节点。Count则表明属于此项的所有子节点的数量。用MoveTo方法将Item由一个位置移到另一个位置。 Expanded属性表明是否所有的子项都全部展开(包括子项的子项),为True表示全部展开。IsVisible属性表明一个项是否在树中能被看到,如果树全部展开那么这个Item是肯定可以被看到。HasChildren属性表明一个项是否有子项。 GetFirstChild, GetLastChild, GetPrevChild, and GetNextChild分别返回当前项子项的第一个、最后一个和前一个、后一个项。GetNextSibling and GetPrevSibling则返回在同一Level下的下一个和上一个项。GetNextVisible and GetPrevVisible则返回能看得到的下一个和上一个项。如果一个节点有Parent,则HasAsParent方法返回True. Parent为当前项的父项。Focused属性确定焦点是否落在此节点上,被Focus时会一个标准的方框围住。很显然,只有一个节点会被聚焦。Selected属性表明一个节点是否被选中,同样只有一个节点会被选中。DropTarget属性表明节点在拖动操作中是源还是目标。

delphi中TreeView控件使用

DELPHI中利用TreeView控件建立目录树 p>Rainbow的话:关于TreeView的使用,还可以参看:联合使用TreeView组件 TreeView是一个显示树型结构的控件,通过它能够方便地管理和显示具有层次结构的信息,是Windows应用程序的基本控件之一。DELPHI虽然具有比较强大的文件管理功能,提供了多个用于文件管理的标准控件,如DriveComboBox、DirectoryListBox、FileListBox等,通过设置它们的属性,使其建立起联系,甚至不用编写一行程序,我们就可以实现在不同的目录之间进行切换,然而这样的目录切换只适用于进行文件的查找定位,而不能方便地进行目录的浏览,例如我们要从c:\windows目录转到c:\program files目录,就必须返回到根目录才能进行切换,而不能象Windows资源管理器那样任意地在不同的目录之间进行浏览与切换。 要实现在不同目录之间任意切换和浏览,还是需要使用TreeView控件,以下程序就利用DELPHI的TreeView控件来建立目录树。 在该程序中采用的各部件以及界面设计如下图所示: 各部件的主要属性设置如下: 该程序利用DriveCommboBox控件来获得系统具有的驱动器,并以此作为目录树的最上层,利用FileListBox控件,通过设置其Filetype属性为fdDirectory,可以获得所需的子目录,在TreeView控件的OnExpanding事件中将得到的子目录加到该控件的某一节点下。 整个程序的源代码如下: unit main;

interface uses Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,FileCtrl,ComCtrls,ImgList; type TForm1=class(TForm) DirTreeView:TTreeView; FileListBox1:TFileListBox; DriveComboBox1:TDriveComboBox; ImageList1:TImageList; procedure FormCreate(Sender:TObject); procedure DirTreeViewExpanding(Sender:TObject;Node:TTreeNode;var AllowExpansion:Boolean); private {Private declarations} public {Public declarations} end; var Form1:TForm1; implementation {$R*.DFM} procedure TForm1.FormCreate(Sender:TObject); var FirstNode,DirNode:TTreeNode; ItemCount,Index:integer; Itemstr:string; begin ItemCount:=DriveComboBox1.Items.Count;//所有驱动器的个数 FirstNode:=DirTreeView.Items.GetFirstNode; for index:=0to ItemCount-1do begin ItemStr:=DriveComboBox1.Items[index]; ItemStr:=copy(ItemStr,1,pos(:,ItemStr));//获得驱动器的名称(比如C/D) DirNode:=DirTreeView.Items.AddChild(FirstNode,ItemStr); DirNode.HasChildren:=true; DirNode.ImageIndex:=0; DirNode.SelectedIndex:=1; end; end; //响应扩展事件 procedure TForm1.DirTreeViewExpanding(Sender:TObject;Node:TTreeNode;Var AllowExpansion:Boolean); var

TreeView属性和方法

TreeView属性和方法 1.常用的几个属性和方法 ~Index 获取树节点在树节点集合中的位置。 ~Nodes 获取分配给树视图控件的树节点集合。 ~Parent 获取或设置控件的父容器。 ~SelectedNode 获取或设置当前在树视图控件中选定的树节点。 ~ExpandAll 展开所有树节点。 ~Checked 获取或设置一个值,用以指示树节点是否处于选中状态。 ~Text 获取或设置在树节点标签中显示的文本。 ~Expand 展开树节点。 ~Clear 清空树 ~Remove 从树视图控件中移除当前树节点。 以上由其他网友总结,补充: ~Height 控件的高度 ~Width 控件的宽度 ~BackColor 背景颜色 ~BorderColor 边框颜色 ~BorderStyle 边框样式 ~BorderWidth 边框宽度 ~CssClass 应用于该控件的CSS类名 ~ExpandedImageUrl 展开时显示的节点图标 ~ImageUrl 未选择或展开是显示的节点图标 ~SelectedImageUrl 选中状态下显示的节点图标 ~Indent 缩进距离,只有在ShowLines设为TRUE时才生效。 ~ShowLines 是否显示层级连接线 ~ShowPlus 是否显示+/-符号按钮 ~ShowToolTip 在有父节点上显示工具提示(+/-号的使用展开/关闭)。 ~AccseeKey 控件使用的键盘快捷键 ~AutoSelect 为TRUE时,当用键盘移动节点时,自动选择新节点 ~AutoPostBack 当改变状态时,自动回存 ~Enabled 控制控件的启用状态 ~EnableViewState 控件是否自动保存其状态以用于往返行程 ~ExpandLevel 初始化控件是展开节点的层数 ~SelectExpands 当选中一个接点时,是否自动展开该节点 ~TabIndex TAB键次序 ~Visible 控件是否可见 2.实用技巧: 1)怎样点击文字(不是+/-号)即可展开(收缩)子节点 将TREE的ShowToolTip 属性设为false即可。 2)当鼠标指到某父接点时,如何不显示显示“节点名:user +/- to expand/collapse”将TREE的SelectExpands 属性设为TRUE即可。

利用TreeView控件实现应用程序的导航

2012年 12月08日 实验类型__验证性__ 实验室_软件实验室二__ 一、实验题目 利用TreeView控件实现一个应用程序的导航 二、实验目的 通过本次实验,使学生进一步掌握https://www.wendangku.net/doc/bb10940229.html,编程模型,掌握树形数据的存储方法,掌握TreeView控件与树形数据的操作,能够搭建一个系统的运行框架,为课程设计做好准备。 三、实验内容 1.设计树形结构的数据库表 2.实现树形数据和TreeView的绑定 3.能够实现应用程序导航的自定义 4.用.NET分层架构设计。 四、实验代码(注明代码所实现的功能) 1.数据库说明:4个表 (1)gg_user:user_id,user_name,user_pwd; gg_codeformat:id,BMMC,BMLX,BMZ;

ht_GoucheHT: DJBM,ZDLX,HTJE,ZDR,SHR;(表中信息通过程序添加) gg_menu:typeid, parid, FullName, Form, isStop, isGroup; gg_HolAuth:user_id,Typeid. 2.TreeView控件用来显示信息的分级视图,如同Windows里的资源管理器的目录。TreeView控件中的各项信息都有一个与之相关的Node对象。TreeView显示Node对象的分层目录结构,每个Node对象均由一个Label对象和其相关的位图组成。在建立TreeView控件后,我们可以展开和折叠、显示或隐藏其中的节点。TreeView控件一般用来显示文件和目录结构、文档中的类层次、索引中的层次和其他具有分层目录结构的信息。。 ‘树形结构的初始化函数 Sub InitTree() Me.TreeView1.Nodes.Clear() Dim dr As SqlClient.SqlDataReader dr = o.getall2dr Dim myTreeNode As TreeNode While dr.Read If o.getQX("001", dr!typeid) = True Then myTreeNode = New TreeNode myTreeNode.Text = dr!FullName https://www.wendangku.net/doc/bb10940229.html, = dr!typeid If dr!isGroup = "0" Then myTreeNode.Tag = dr!Form Else myTreeNode.Tag = "" End If

C#中TreeView控件的用法

TreeView组件是由多个类来定义的,TreeView组件是由命名空间"System.Windows.Forms"中的"TreeView"类来定义的,而其中的节点(即Node),是由命名空间"System.Windows.Forms"中的"TreeNode"来定义的。所以当在程序中创建一个TreeView对象,其实只是创建了一个可以放置节点的"容器"。而在这个容器中加入一个节点,其实就是加入了从"TreeNode"类中创建的一个节点对象;同样删除一个节点,也就是删除一个"TreeNode"节点对象。 一、C#操作TreeView组件中的一些常用方法以及具体实现: TreeView组件虽然是一个操作起来比较麻烦的组件,但归根到底,可以总结为三种基本操作:加入子节点、加入兄弟节点和删除节点。掌握了这三种常用操作,对于在编程中灵活运用TreeView组件是十分必要的。下面就分别来加以介绍。 (1).加入子节点: 所谓子节点,就是处于选定节点的下一级节点。加入子节点的具体过程是:首先要在TreeView 组件中定位要加入的子节点的位置,然后创建一个节点对象,然后利用TreeVeiw类中对节点的加入方法(即:Add ( )方法),加入此节点对象。下面就是在treeView1组件中加入一个子节点的具体代码: //首先判断是否选定组件中的位置 if ( treeView1.SelectedNode == null ) { MessageBox.Show ( "请选择一个节点" , "提示信息" , MessageBoxButtons.OK , https://www.wendangku.net/doc/bb10940229.html,rmation ) ; } else { //创建一个节点对象,并初始化 TreeNode tmp ; tmp = new TreeNode ( "节点名称" ) ; //在TreeView组件中加入子节点 treeView1.SelectedNode.Nodes.Add ( tmp ) ; treeView1.SelectedNode = tmp ; treeView1.ExpandAll ( ) ; }

PB中TreeView控件使用技巧

PB中TreeView控件使用技巧 一、应用TreeView 控件的一般步骤 1、建立一个应用,并设好与数据库的接口,这是操作数据库的前提。 2、在应用中建一应用窗口W_1,在其上加入二个名为dw_3和dw_4的datawindow控制对象和一个名为TV_1的TreeView对象。 3、修改DW_3属性 General:把Datawindow object name填写一个已存在的名为DW_date的datawindow(注意:它与datawindow控制对象是不同的),用于生成树视图项,将其Visible项设为不可见。 4、修改DW_4属性 General:把Datawindow object name填写一个已存在的名为DW_TS的datawindow对象,用于显示查询出的具体内容。 5、编辑TV_1的属性 TreeView的树视图项不能直接编辑,必须在Script中编写程序。 Picture:在Picture Name中加入四个不同的图标,用于代表树视图中的两个层次(一、二级)、两种状态(未选、选中)。 General:可根据具体应用设定是否选中,其中: Delete Items:运行中是否允许删除表项。 Disable PragDrog: 运行中是否允许拖放表项。 Edit Labels: 运行中是否允许单击表项来改变表项的标题。 Show Buttons:是否在表项放显示+-按钮,有示相对的扩展和收缩。 Hide Selection:当该控件失去焦点时,选中项是否以高亮度显示。 Show Line:表项间是否加一竖线。 Lines At Root:所有根层表项是否用竖线连接。 Indentation:子表项相对于父表项的向右缩进度。

三小时掌握TREEVIEW控件--access

三小时掌握TREEVIEW控件 TREEVIEW控件在正常ACCESS数据库使用中是很频繁的,下面这篇文章与大家分享一下: 一、详见如下: 能不能掌握控件的使用,是业余向准专业进步的关键。比如TREEVIEW控件,TREEVIEW控件,也叫树控件,主要用于层级显示和控制,应用广泛。我一直很想学习这个控件的使用,但每次都没有学成,总感觉很难。前几天有空,狠下心来将论坛搜索一遍,发现也不是太难,在很短时间内只要方法得当,很快可以掌握,因为我是菜鸟,所以用菜鸟的方法和大家交流,可能大家学得更快一点,只要你用心,三个小时一定可以掌握。请大家一定要自己动手做,只有做才能理解,光看帮助和说明是没有用的。 热身:理解层级概念,层级理论上可以有无限级,一般用到四,五级也够用了。最上级的只能有一个,我们把它叫做“爷”,接下来是“父”,再是“子”,再是“孙”,接下来是“曾孙”......,汇总如下:“爷,父,子,孙,曾孙”,这里是5级关系,除了“爷”只能有一个外,其余可以有无限个。记住这些,下面要用。 第一小时:学习直接用代码将数据填充到树控件中。 为什么要先学习直接用代码将数据填充到树控件中?因为这种方法是最简单的,代码也最容易理解,学习树控件,先将这个学会,已经掌握了一半,所以先不要急着想怎么将表中的数据填充到树控件中,在第一小时里,树控件和表完全没有关系。 目的:我们要在树控件中建立如下的一个3层级关系 水果 | |__苹果 | |__红富士 | |__国光 | |__葡萄 |__红提子 |__青提子 解释:水果包含2种,一种是苹果,一种是葡萄,苹果又包含2种,一种是红富士,一种是国光,葡萄也如此。 在这里:“爷”是水果,“父”是苹果,葡萄,“子”是红富士,国光,红提子,青提子。概括如下: 爷(只能有一个):水果 父(这里有2个):父1:苹果;父2:葡萄 子(这里有4个):子1:红富士(父1苹果的子);子2:国光(父1苹果的子);子3:红提子(父2葡萄的子);子4:青提子(父2葡萄的子) 下面我们在ACCESS中栽下这棵树,步骤如下: 1、新建一个窗体,在窗体上放置两个控件,一个是Treeview,一个是Imagelist 如何找到这两个控件? Treeview控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Treeview Control,Version 6.0";Imagelist控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Imagelist Control,Version 6.0"。 Treeview控件大家都明白干什么用的,Imagelist控件是干什么用呢?原来这个控件是放图标用的,如果你想在树控件中显示图标的,这个图标都将储存在ImageList控件中。

TREEVIEW控件

掌握TREEVIEW控件 TREEVIEW控件在正常ACCESS数据库使用中是很频繁的,下面这篇文章与大家分享一下: 一、详见如下: 能不能掌握控件的使用,是业余向准专业进步的关键。比如TREEVIEW控件,TREEVIEW控件,也叫树控件,主要用于层级显示和控制,应用广泛。我一直很想学习这个控件的使用,但每次都没有学成,总感觉很难。前几天有空,狠下心来将论坛搜索一遍,发现也不是太难,在很短时间内只要方法得当,很快可以掌握,因为我是菜鸟,所以用菜鸟的方法和大家交流,可能大家学得更快一点,只要你用心,三个小时一定可以掌握。请大家一定要自己动手做,只有做才能理解,光看帮助和说明是没有用的。 热身:理解层级概念,层级理论上可以有无限级,一般用到四,五级也够用了。最上级的只能有一个,我们把它叫做“爷”,接下来是“父”,再是“子”,再是“孙”,接下来是“曾孙”......,汇总如下:“爷,父,子,孙,曾孙”,这里是5级关系,除了“爷”只能有一个外,其余可以有无限个。记住这些,下面要用。 第一小时:学习直接用代码将数据填充到树控件中。 为什么要先学习直接用代码将数据填充到树控件中?因为这种方法是最简单的,代码也最容易理解,学习树控件,先将这个学会,已经掌握了一半,所以先不要急着想怎么将表中的数据填充到树控件中,在第一小时里,树控件和表完全没有关系。 目的:我们要在树控件中建立如下的一个3层级关系 水果 | |__苹果 | |__红富士 | |__国光 | |__葡萄 |__红提子 |__青提子 解释:水果包含2种,一种是苹果,一种是葡萄,苹果又包含2种,一种是红富士,一种是国光,葡萄也如此。 在这里:“爷”是水果,“父”是苹果,葡萄,“子”是红富士,国光,红提子,青提子。概括如下: 爷(只能有一个):水果 父(这里有2个):父1:苹果;父2:葡萄 子(这里有4个):子1:红富士(父1苹果的子);子2:国光(父1苹果的子);子3:红提子(父2葡萄的子);子4:青提子(父2葡萄的子) 下面我们在ACCESS中栽下这棵树,步骤如下: 1、新建一个窗体,在窗体上放置两个控件,一个是Treeview,一个是Imagelist 如何找到这两个控件? Treeview控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Treeview Control,Version 6.0";Imagelist控件在“工具箱”的榔头加扳手图标(其他控件)中选“Microsoft Imagelist Control,Version 6.0"。 Treeview控件大家都明白干什么用的,Imagelist控件是干什么用呢?原来这个控件是放图标用的,如果你想在树控件中显示图标的,这个图标都将储存在ImageList控件中。

Aspnet中 Treeview 控件常用属性

1.常用的几个属性和方法 ~Index 获取树节点在树节点集合中的位置。 ~Nodes 获取分配给树视图控件的树节点集合。 ~Parent 获取或设置控件的父容器。 ~SelectedNode 获取或设置当前在树视图控件中选定的树节点。 ~ExpandAll 展开所有树节点。 ~Checked 获取或设置一个值,用以指示树节点是否处于选中状态。~Text 获取或设置在树节点标签中显示的文本。 ~Expand 展开树节点。 ~Clear 清空树 ~Remove 从树视图控件中移除当前树节点。 以上由其他网友总结,补充: ~Height 控件的高度 ~Width 控件的宽度 ~BackColor 背景颜色 ~BorderColor 边框颜色 ~BorderStyle 边框样式 ~BorderWidth 边框宽度 ~CssClass 应用于该控件的CSS类名 ~ExpandedImageUrl 展开时显示的节点图标 ~ImageUrl 未选择或展开是显示的节点图标 ~SelectedImageUrl 选中状态下显示的节点图标

~Indent 缩进距离,只有在ShowLines设为TRUE时才生效。 ~ShowLines 是否显示层级连接线 ~ShowPlus 是否显示+/-符号按钮 ~ShowToolTip 在有父节点上显示工具提示(+/-号的使用展开/关闭)。 ~AccseeKey 控件使用的键盘快捷键 ~AutoSelect 为TRUE时,当用键盘移动节点时,自动选择新节点 ~AutoPostBack 当改变状态时,自动回存 ~Enabled 控制控件的启用状态 ~EnableViewState 控件是否自动保存其状态以用于往返行程 ~ExpandLevel 初始化控件是展开节点的层数 ~SelectExpands 当选中一个接点时,是否自动展开该节点 ~TabIndex TAB键次序 ~Visible 控件是否可见 2.实用技巧: 1)怎样点击文字(不是+/-号)即可展开(收缩)子节点 将TREE的ShowToolTip 属性设为false即可。 2)当鼠标指到某父接点时,如何不显示显示“节点名:user +/- to expand/collapse” 将TREE的SelectExpands 属性设为TRUE即可。 3)不显示树型的问题

excelvbatreeview控件概述、属性与方法

TreeView控件概述、属性与方法 1、作用:用于显示Node结点的分层列表。 2、添加到控件箱 菜单命令:工程 | 部件,在部件对话框中选择:Microsoft Windows Common Controls 3、TreeView控件的属性 (1)属性对话框 用鼠标右键单击TreeView控件,在弹出式菜单中选择属性,进入属性设置对话框,该对话框分为如图所示。 ? 图 TreeView属性设置对话框 ①样式(Style):返回或设置在Node结点之间显示的线样式,如表所示。 ? 表 TreeView控件的显示样式 ②鼠标指针(MousePoint):可选择不同鼠标样式,如表所示。 ③线条样式(LineStyle):0-tvwTreeLine 无根结点的树形结构,1-tvwRootLines有根结点的树 ④标签编辑(LabelEdit):0-tvwAutomatic 自动,1-tvwManual 手工; ⑤图像列表(ImageList):结点图标所用ImageList控件; ⑥边框样式(BorderStyle):0-ccNone无边框,1-ccFixedSingle单边框;

⑦外观(Appearence):0-ccFlat平面效果,1-cc3D 3D效果; ⑧缩进:父子结点的水平间距。 (2)其它属性 ① 属性:用于返回或设置当前Node结点的内容。 ② CheckBoxes属性:该属性只能取逻辑值,若取True值,则每个Node结点前出现一个复选框,4、TreeView控件的方法 (1)Node结点 ① Node结点:是TreeView控件中的一项,它包含图像与文本。 ② Nodes结点集合:包含一个或多个Node结点。 (2)Add方法 ①作用:为TreeView控件添加节点和子节点。 ②定义格式 Image,SelectedImage) 其中: ◆ Relative参数:添加新结点时,其父结点键值Key。添加根结点时,此项为空。 ◆Relationship参数:新结点的相对位置: tvwlast—1:新节点位于同级别所有节点之后; tvwNext—2:新节点位于当前节点之后; tvwPrevious—3:新节点位于当前节点之前; tvwChild—4:新节点成为当前节点的子节点。 ◆Key:Node结点关键字(唯一标识符),用于检索Node结点。同时也作为其新建子结点的Relative 父结点Key。 ◆Text:Node结点文本。 ◆Image:Node结点位图,是关联ImageList控件中位图的索引。 在这些参数中,只有Text参数是必需的,其它参数都是可选的。 例如,在TreeView1控件的根结点上添加“计算机系”结点的程序段如下: Dim Nod As Node Key= "计算机系" Text= "计算机系" Set Nod = tvwChild, Key, Text) 而在计算机系结点下添加“计算机30331”班子结点的程序段如下: Key1= "计算机30331 " Text1= "计算机30331 " Set Nod = tvwChild, Key1, Text1) 上述程序段运行后,屏幕显示如图所示 ? 图在TreeView添加计算机系与计算机30031班 (2)Clear方法:用于删除TreeView控件的所有Node结点。 (3)Remove方法:用于移动TreeView控件的结点位置。 key值不能为数字

相关文档