当前位置: 首页>>代码示例>>C#>>正文


C# TreeView.allNodes方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeView.allNodes方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.allNodes方法的具体用法?C# TreeView.allNodes怎么用?C# TreeView.allNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeView的用法示例。


在下文中一共展示了TreeView.allNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buildGui

		public ascx_CodeStreams buildGui() 
		{
			//codeViewer = this.add_SourceCodeViewer();
			_codeEditor = this.add_SourceCodeEditor();
			codeStreams = _codeEditor.insert_Right().add_GroupBox("All Code Streams").add_TreeView();
			codeStreamViewer = codeStreams.parent().insert_Below().add_GroupBox("Selected Code Stream").add_TreeView(); 
			//var codeStreamViewer = topPanel.insert_Right().add_TreeView();
			
			Action<TreeNode, CodeStreamPath> add_CodeStreamPath = null;
			
			add_CodeStreamPath = 
				(treeNode, codeStreamPath)=>{
												var newNode = treeNode.add_Node(codeStreamPath);
												foreach(var childPath in codeStreamPath.CodeStreamPaths)
													add_CodeStreamPath(newNode, childPath);
											};
											
			Action<TreeView, CodeStreamPath> showCodeStreamPath= 
				(treeView, codeStreamPath)=>{																		
												treeView.clear(); 
												add_CodeStreamPath(treeView.rootNode(), codeStreamPath);
												treeView.expandAll();
												treeView.selectFirst();
											};
			
			Action<SourceCodeEditor, CodeStreamPath, bool> colorCodePath = 
				(codeEditor, codeStreamPath, clearMarkers)=>
					{												
						if (codeEditor.getSourceCode().inValid() || codeStreamPath.Line == 0 && codeStreamPath.Column ==0)
							return;						
						try
						{
							if (clearMarkers)
							{
								codeEditor.clearMarkers(); 								
								codeEditor.caret(codeStreamPath.Line,codeStreamPath.Column);
							}
							codeEditor.selectTextWithColor( codeStreamPath.Line,
															codeStreamPath.Column,
															codeStreamPath.Line_End,
															codeStreamPath.Column_End);
							codeEditor.refresh(); 										
						}
						catch(Exception ex)
						{
							ex.log();
						}					
				  	};
			
			Action<SourceCodeEditor, List<CodeStreamPath>> colorCodePaths = 
				(codeEditor, codeStreamPaths)=> {
													foreach(var codeStreamPath in codeStreamPaths)
														colorCodePath(codeEditor, codeStreamPath,false); 
											    };
				
			Action<TreeView,SourceCodeEditor> set_AfterSelect_SyncWithCodeEditor = 
				(treeView, codeEditor)=>{
								treeView.afterSelect<CodeStreamPath>(
										(codeStreamPath)=> colorCodePath(codeEditor, codeStreamPath,true ) );
			
							};
			
			
			set_AfterSelect_SyncWithCodeEditor(codeStreams, _codeEditor.editor()); 
			set_AfterSelect_SyncWithCodeEditor(codeStreamViewer, _codeEditor.editor());
			
			codeStreams.afterSelect<CodeStreamPath>(
				(codeStreamPath)=> showCodeStreamPath(codeStreamViewer, codeStreamPath));											
					
			
			codeStreams.beforeExpand<CodeStreamPath>(
				(treeNode, codeStreamPath)=>{
												treeNode.add_Nodes(codeStreamPath.CodeStreamPaths, (codeStream) => codeStream.CodeStreamPaths.size() > 0 );
											});
			
			
			_codeEditor.onClick(
				()=>{ 
						if (savedMethodStream.notNull())
						{	
							_codeEditor.editor().clearMarkers();  
							codeStreamViewer.clear();
							codeStreams.clear();
							var line = _codeEditor.caret().Line + 1; 				
							var column = _codeEditor.caret().Column + 1;  							
							CodeStreamPath lastMatch = null;
							foreach(var codeStreamPath in savedMethodStream.CodeStreams)
							{
								if (codeStreamPath.Line <= line && codeStreamPath.Line_End >= line &&
								    codeStreamPath.Column <= column && codeStreamPath.Column_End >= column)
								    {
								    	codeStreams.add_Node(codeStreamPath);
										lastMatch = codeStreamPath;																									
									}
							}
							if (lastMatch.notNull())
							{								
								showCodeStreamPath(codeStreamViewer, lastMatch);
								var codeStreamPaths = (from node in codeStreamViewer.allNodes() 
													   select (CodeStreamPath)node.get_Tag()).toList();
//.........这里部分代码省略.........
开发者ID:jobyjames85,项目名称:O2.Platform.Scripts,代码行数:101,代码来源:ascx_CodeStreams.cs


注:本文中的System.Windows.Forms.TreeView.allNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。