http://www.tutorialspoint.com/vb.net/vb.net_treeview.htm

vbscript教程  时间:2021-02-27  阅读:()
Copyrighttutorialspoint.
comVB.
NET-TREEVIEWCONTROLVB.
NET-TREEVIEWCONTROLTheTreeViewcontrolisusedtodisplayhierarchicalrepresentationsofitemssimilartothewaysthefilesandfoldersaredisplayedintheleftpaneoftheWindowsExplorer.
Eachnodemaycontainoneormorechildnodes.
Let'sclickonaTreeViewcontrolfromtheToolboxandplaceitontheform.
PropertiesoftheTreeViewControlThefollowingaresomeofthecommonlyusedpropertiesoftheTreeViewcontrol:S.
NPropertyDescription1BackColorGetsorsetsthebackgroundcolorforthecontrol.
2BackgroundImageGetsorsetthebackgroundimagefortheTreeViewcontrol.
3BackgroundImageLayoutGetsorsetsthelayoutofthebackgroundimagefortheTreeViewcontrol.
4BorderStyleGetsorsetstheborderstyleofthetreeviewcontrol.
5CheckBoxesGetsorsetsavalueindicatingwhethercheckboxesaredisplayednexttothetreenodesinthetreeviewcontrol.
6DataBindingsGetsthedatabindingsforthecontrol.
7FontGetsorsetsthefontofthetextdisplayedbythecontrol.
8FontHeightGetsorsetstheheightofthefontofthecontrol.
9ForeColorThecurrentforegroundcolorforthiscontrol,whichisthecolorthecontrolusestodrawitstext.
10ItemHeightGetsorsetstheheightofeachtreenodeinthetreeviewcontrol.
11NodesGetsthecollectionoftreenodesthatareassignedtothetreeviewcontrol.
12PathSeparatorGetsorsetsthedelimiterstringthatthetreenodepathuses.
13RightToLeftLayoutGetsorsetsavaluethatindicateswhethertheTreeViewshouldbelaidoutfromright-to-left.
14ScrollableGetsorsetsavalueindicatingwhetherthetreeviewcontroldisplaysscrollbarswhentheyareneeded.
15SelectedImageIndexGetsorsetstheimagelistindexvalueoftheimagethatisdisplayedwhenatreenodeisselected.
16SelectedImageKeyGetsorsetsthekeyofthedefaultimageshownwhenaTreeNodeisinaselectedstate.
17SelectedNodeGetsorsetsthetreenodethatiscurrentlyselectedinthetreeviewcontrol.
18ShowLinesGetsorsetsavalueindicatingwhetherlinesaredrawnbetweentreenodesinthetreeviewcontrol.
19ShowNodeToolTipsGetsorsetsavalueindicatingToolTipsareshownwhenthemousepointerhoversoveraTreeNode.
20ShowPlusMinusGetsorsetsavalueindicatingwhetherplus-sign+andminus-signbuttonsaredisplayednexttotreenodesthatcontainchildtreenodes.
21ShowRootLinesGetsorsetsavalueindicatingwhetherlinesaredrawnbetweenthetreenodesthatareattherootofthetreeview.
22SortedGetsorsetsavalueindicatingwhetherthetreenodesinthetreeviewaresorted.
23StateImageListGetsorsetstheimagelistthatisusedtoindicatethestateoftheTreeViewanditsnodes.
24TextGetsorsetsthetextoftheTreeView.
25TopNodeGetsorsetsthefirstfully-visibletreenodeinthetreeviewcontrol.
26TreeViewNodeSorterGetsorsetstheimplementationofIComparertoperformacustomsortoftheTreeViewnodes.
27VisibleCountGetsthenumberoftreenodesthatcanbefullyvisibleinthetreeviewcontrol.
MethodsoftheTreeViewControlThefollowingaresomeofthecommonlyusedmethodsoftheTreeViewcontrol:S.
NMethodName&Description1CollapseAllCollapsesallthenodesincludingallchildnodesinthetreeviewcontrol.
2ExpandAllExpandsallthenodes.
3GetNodeAtGetsthenodeatthespecifiedlocation.
4GetNodeCountGetsthenumberoftreenodes.
5SortSortsalltheitemsinthetreeviewcontrol.
6ToStringReturnsastringcontainingthenameofthecontrol.
EventsoftheTreeViewControlThefollowingaresomeofthecommonlyusedeventsoftheTreeViewcontrol:S.
NEventDescription1AfterCheckOccursafterthetreenodecheckboxischecked.
2AfterCollapseOccursafterthetreenodeiscollapsed.
3AfterExpandOccursafterthetreenodeisexpanded.
4AfterSelectOccursafterthetreenodeisselected.
5BeforeCheckOccursbeforethetreenodecheckboxischecked.
6BeforeCollapseOccursbeforethetreenodeiscollapsed.
7BeforeExpandOccursbeforethetreenodeisexpanded.
8BeforeLabelEditOccursbeforethetreenodelabeltextisedited.
9BeforeSelectOccursbeforethetreenodeisselected.
10ItemDragOccurswhentheuserbeginsdragginganode.
11NodeMouseClickOccurswhentheuserclicksaTreeNodewiththemouse.
12NodeMouseDoubleClickOccurswhentheuserdouble-clicksaTreeNodewiththemouse.
13NodeMouseHoverOccurswhenthemousehoversoveraTreeNode.
14PaddingChangedOccurswhenthevalueofthePaddingpropertychanges.
15PaintOccurswhentheTreeViewisdrawn.
16RightToLeftLayoutChangedOccurswhenthevalueoftheRightToLeftLayoutpropertychanges.
17TextChangedOccurswhentheTextpropertychanges.
TheTreeNodeClassTheTreeNodeclassrepresentsanodeofaTreeView.
EachnodeinaTreeViewcontrolisanobjectoftheTreeNodeclass.
TobeabletouseaTreeViewcontrolweneedtohavealookatsomecommonlyusedpropertiesandmethodsoftheTreeNodeclass.
PropertiesoftheTreeNodeClassThefollowingaresomeofthecommonlyusedpropertiesoftheTreeNodeclass:S.
NPropertyDescription1BackColorGetsorsetsthebackgroundcolorofthetreenode.
2CheckedGetsorsetsavalueindicatingwhetherthetreenodeisinacheckedstate.
3ContextMenuGetstheshortcutmenuthatisassociatedwiththistreenode.
4ContextMenuStripGetsorsetstheshortcutmenuassociatedwiththistreenode.
5FirstNodeGetsthefirstchildtreenodeinthetreenodecollection.
6FullPathGetsthepathfromtheroottreenodetothecurrenttreenode.
7IndexGetsthepositionofthetreenodeinthetreenodecollection.
8IsEditingGetsavalueindicatingwhetherthetreenodeisinaneditablestate.
9IsExpandedGetsavalueindicatingwhetherthetreenodeisintheexpandedstate.
10IsSelectedGetsavalueindicatingwhetherthetreenodeisintheselectedstate.
11IsVisibleGetsavalueindicatingwhetherthetreenodeisvisibleorpartiallyvisible.
12LastNodeGetsthelastchildtreenode.
13LevelGetsthezero-baseddepthofthetreenodeintheTreeViewcontrol.
14NameGetsorsetsthenameofthetreenode.
15NextNodeGetsthenextsiblingtreenode.
16NodesGetsthecollectionofTreeNodeobjectsassignedtothecurrenttreenode.
17ParentGetstheparenttreenodeofthecurrenttreenode.
18PrevNodeGetstheprevioussiblingtreenode.
19PrevVisibleNodeGetsthepreviousvisibletreenode.
20TagGetsorsetstheobjectthatcontainsdataaboutthetreenode.
21TextGetsorsetsthetextdisplayedinthelabelofthetreenode.
22ToolTipTextGetsorsetsthetextthatappearswhenthemousepointerhoversoveraTreeNode.
23TreeViewGetstheparenttreeviewthatthetreenodeisassignedto.
MethodsoftheTreeNodeClassThefollowingaresomeofthecommonlyusedmethodsoftheTreeNodeclass:S.
NMethodName&Description1CollapseCollapsesthetreenode.
2ExpandExpandsthetreenode.
3ExpandAllExpandsallthechildtreenodes.
4GetNodeCountReturnsthenumberofchildtreenodes.
5RemoveRemovesthecurrenttreenodefromthetreeviewcontrol.
6ToggleTogglesthetreenodetoeithertheexpandedorcollapsedstate.
7ToStringReturnsastringthatrepresentsthecurrentobject.
ExampleInthisexample,letuscreateatreeviewatruntime.
Let'sdoubleclickontheFormandputthefollowcodeintheopenedwindow.
PublicClassForm1PrivateSubForm1_Load(senderAsObject,eAsEventArgs)HandlesMyBase.
Load'createanewTreeViewDimTreeView1AsTreeViewTreeView1=NewTreeView()TreeView1.
Location=NewPoint(10,10)TreeView1.
Size=NewSize(150,150)Me.
Controls.
Add(TreeView1)TreeView1.
Nodes.
Clear()'CreatingtherootnodeDimroot=NewTreeNode("Application")TreeView1.
Nodes.
Add(root)TreeView1.
Nodes(0).
Nodes.
Add(NewTreeNode("Project1"))'CreatingchildnodesunderthefirstchildForloopindexAsInteger=1To4TreeView1.
Nodes(0).
Nodes(0).
Nodes.
Add(New_TreeNode("SubProject"&Str(loopindex)))Nextloopindex'creatingchildnodesundertherootTreeView1.
Nodes(0).
Nodes.
Add(NewTreeNode("Project6"))'creatingchildnodesunderthecreatedchildnodeForloopindexAsInteger=1To3TreeView1.
Nodes(0).
Nodes(1).
Nodes.
Add(New_TreeNode("ProjectFile"&Str(loopindex)))Nextloopindex'Setthecaptionbartextoftheform.
Me.
Text="tutorialspoint.
com"EndSubEndClassWhentheabovecodeisexecutedandrunusingStartbuttonavailableattheMicrosoftVisualStudiotoolbar,itwillshowthefollowingwindow:Youcanexpandthenodestoseethechildnodes:Loading[MathJax]/jax/output/HTML-CSS/jax.
js

瓜云互联-美国洛杉矶高防CN2高防云服务器,新老用户均可9折促销!低至32.4元/月!

瓜云互联一直主打超高性价比的海外vps产品,主要以美国cn2、香港cn2线路为主,100M以内高宽带,非常适合个人使用、企业等等!安全防护体系 弹性灵活,能为提供简单、 高效、智能、快速、低成本的云防护,帮助个人、企业从实现网络攻击防御,同时也承诺产品24H支持退换,不喜欢可以找客服退现,诚信自由交易!官方网站:点击访问瓜云互联官网活动方案:打折优惠策略:新老用户购买服务器统统9折优惠预存返款活动...

JustHost俄罗斯VPS有HDD、SSD、NVMe SSD,不限流量低至约9.6元/月

justhost怎么样?justhost服务器好不好?JustHost是一家成立于2006年的俄罗斯服务器提供商,支持支付宝付款,服务器价格便宜,200Mbps大带宽不限流量,支持免费更换5次IP,支持控制面板自由切换机房,目前JustHost有俄罗斯6个机房可以自由切换选择,最重要的还是价格真的特别便宜,最低只需要87卢布/月,约8.5元/月起!总体来说,性价比很高,性价比不错,有需要的朋友可以...

buyvm美国大硬盘VPS,1Gbps带宽不限流量

buyvm正式对外开卖第四个数据中心“迈阿密”的块存储服务,和前面拉斯维加斯、纽约、卢森堡一样,依旧是每256G硬盘仅需1.25美元/月,最大支持10T硬盘。配合buyvm自己的VPS,1Gbps带宽、不限流量,在vps上挂载块存储之后就可以用来做数据备份、文件下载、刷BT等一系列工作。官方网站:https://buyvm.net支持信用卡、PayPal、支付宝付款,支付宝付款用的是加元汇率,貌似...

vbscript教程为你推荐
找不到光驱我的电脑里找不到光驱快速美白好方法有什么快速美白的好办法吗?吴晓波频道买粉五大知识付费平台有哪些?二叉树遍历二叉树三种遍历方式原则?自助建站自助建站到底好还是不好唱吧电脑版官方下载唱吧有电脑版的么? 在哪里下载啊?ios7固件下载ios 7及以上固件请在设备上点信任在哪点xp系统停止服务XP系统为什么要停止服务?qq空间打扮QQ空间怎么打扮如何打扮系统分析员一个优秀的系统分析师应该具备哪些方面的知识和素质?
如何注册中文域名 七牛优惠码 西安电信测速 唯品秀 fastdomain 万网优惠券 免费smtp服务器 双十一秒杀 最好的qq空间 gtt 优酷黄金会员账号共享 免费邮件服务器 yundun 512mb 空间登录首页 登陆空间 linode支付宝 smtp服务器地址 万网空间 华为k3 更多