• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.TreeNodeCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



TreeNodeCollection类属于System.Windows.Forms命名空间,在下文中一共展示了TreeNodeCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetSubKey

 /// <summary>
 /// 获取注册表项的子节点,并将其添加到树形控件节点中
 /// </summary>
 /// <param name="nodes"></param>
 /// <param name="rootKey"></param>
 public void GetSubKey(TreeNodeCollection nodes, RegistryKey rootKey)
 {
     if (nodes.Count != 0) return;
     //获取项的子项名称列表
     string[] keyNames = rootKey.GetSubKeyNames();
     //遍历子项名称
     foreach (string keyName in keyNames)
     {
     try
     {
     //根据子项名称功能注册表项
     RegistryKey key = rootKey.OpenSubKey(keyName);
     //如果表项不存在,则继续遍历下一表项
     if (key == null) continue;
     //根据子项名称创建对应树形控件节点
     TreeNode TNRoot = new TreeNode(keyName);
     //将注册表项与树形控件节点绑定在一起
     TNRoot.Tag = key;
     //向树形控件中添加节点
     nodes.Add(TNRoot);
     }
     catch
     {
     //如果由于权限问题无法访问子项,则继续搜索下一子项
     continue;
     }
     }
 }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:33,代码来源:FormExplorer.cs


示例2: initTrvTree

        public void initTrvTree(TreeNodeCollection treeNodes, string strParentIndex, DataView dvList)
        {
            try
            {
                TreeNode tempNode;
                DataView dvList1;
                string currentNum;
                dvList1 = dvList;
                // select the datarow that it's parentcode is strParentIndex
                DataRow[] dataRows = dvList.Table.Select("parentCode ='" + strParentIndex + "'");
                foreach (DataRow dr in dataRows)
                {
                    tempNode = new TreeNode();
                    tempNode.Text = dr["bookTypeCode"].ToString() + "-"
                        + dr["bookTypeName"].ToString();
                    // tag property is save data about this treenode
                    tempNode.Tag = new treeNodeData(dr["bookTypeCode"].ToString(),
                        dr["bookTypeName"].ToString(), dr["bookTypeExplain"].ToString(),
                        dr["currentCode"].ToString(), dr["parentCode"].ToString());

                    currentNum = dr["currentCode"].ToString();
                    treeNodes.Add(tempNode);
                    // call rucursive
                    TreeNodeCollection temp_nodes = treeNodes[treeNodes.Count - 1].Nodes;
                    initTrvTree(temp_nodes, currentNum, dvList1);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("初始化TreeView失败");
            }
        }
开发者ID:ATLgo,项目名称:bookMis,代码行数:32,代码来源:bookTypeClass.cs


示例3: expandNamespace_function

        private void expandNamespace_function(TreeNodeCollection outNodes, string strSection, string strNamespace, XmlReader reader)
        {
            bool bContinue = reader.ReadToDescendant("function");
            while (bContinue)
            {
                NodeDocPythonFunction node = newnode(strSection, strNamespace, reader.GetAttribute("name"));
                outNodes.Add(node);

                bool bInstance = reader.GetAttribute("instance") == "true";
                node.bIsInstanceMethod = bInstance;
                string strSyntax = reader.GetAttribute("fullsyntax"); if (strSyntax != null && strSyntax != "") node.strFullSyntax = strSyntax;
                node.strDocumentation = getFunctionDocAndExample(reader.ReadSubtree()); //assumes doc before example

                if (this.emphasizeStaticness())
                {
                    if (!bInstance)
                    {
                        //change visible node text to emphasize static-ness
                        node.Text = node.strNamespacename + "." + node.strFunctionname;
                    }
                }
                bContinue = ReadToNextSibling(reader, "function");
            }

            reader.Close();
        }
开发者ID:downpoured,项目名称:lnzscript,代码行数:26,代码来源:DocumentationFromPythonXml.cs


示例4: ShowData

        internal void ShowData(TreeNodeCollection nodes)
        {
            var lst = getSelection(nodes);
            chart.Series.Clear();

            var logarithmic = btnLogarithmicScale.Checked;

            var area = chart.ChartAreas[0];
            area.AxisY.IsLogarithmic = logarithmic;

            var chartType = cboStyle.Text.AsEnum<SeriesChartType>(SeriesChartType.Spline);

            foreach(var sel in lst)
            {
                var series = chart.Series.Add( sel.m_Type.Name + "::" + sel.m_Source );
                series.ChartType = chartType;

                foreach(var d in sel.m_Data)
                {
                    var v = d.ValueAsObject;

                    if (logarithmic)
                    {
                        if (v is long) v = 1 +(long)v;
                        if (v is double) v = 1 +(double)v;
                    }
                    series.Points.AddXY(d.UTCTime, v );
                }
            }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:30,代码来源:ChartForm.cs


示例5: LoadTagBlockValuesAsNodes

 private void LoadTagBlockValuesAsNodes(TreeNodeCollection treeNodeCollection, TagBlock block)
 {
     //Add this TagBlock (chunk) to the Nodes
     treeNodeCollection.Add(block.ToString());
     int index = treeNodeCollection.Count - 1;
     treeNodeCollection[index].ContextMenuStrip = chunkMenu;
     //Add the TagBlock (chunk) object to the Tag to let use edit it directly from the node
     treeNodeCollection[index].Tag = block;
     //Values might be null, dealio
     if (block.Values == null) return;
     foreach (Value val in block.Values)
     {
         //the Values can be a bunch of things, we only want the ones that are TagBlockArrays (reflexives)
         if (val is TagBlockArray)
         {
             treeNodeCollection[index].Nodes.Add(val.ToString());
             treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].ContextMenuStrip = reflexiveMenu;
             //Add the TagBlockArray object (reflexive) to the Tag to let us edit it directly from the node
             treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].Tag = val;
             //TagBlocks also might be null, dealio
             if ((val as TagBlockArray).TagBlocks == null) continue;
             foreach (TagBlock tagBlock in (val as TagBlockArray).TagBlocks)
             {
                 //Recurse
                 LoadTagBlockValuesAsNodes(treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].Nodes, tagBlock);
             }
         }
     }
 }
开发者ID:kholdfuzion,项目名称:halo2x-sunfish,代码行数:29,代码来源:MainForm.cs


示例6: AddSourceNodeToRoot

        private void AddSourceNodeToRoot(Guid source, TreeNodeCollection coll)
        {
            var node = new TreeNode
                           {
                               Name = source.ToString(),
                               Text = source.ToString()
                           };

            node.ContextMenu = new ContextMenu(
                new[]
                    {
                        new MenuItem("Delete",
                                     (sender, args) =>
                                         {
                                             var senderNode = ((sender as MenuItem).Parent.Tag as TreeNode);
                                             if (senderNode.Nodes.Count > 0)
                                             {
                                                 MessageBox.Show("Nodes containing events cannot be deleted.");
                                                 return;
                                             }
                                             store.RemoveEmptyEventSource(Guid.Parse(node.Name));
                                             senderNode.Remove();
                                         }
                            )
                    }
                ) { Tag = node };

            coll.Add(node);

            var events = store.GetAllEvents(source);
            foreach (var evt in events)
            {
                AddEvtNodeToSourceNode(evt, node);
            }
        }
开发者ID:phillipknauss,项目名称:CqrsSiteEngine,代码行数:35,代码来源:EventStoreExplorer.cs


示例7: HoleAlleAusgewaehltenEmpfaengerIDs

 public static ArrayList HoleAlleAusgewaehltenEmpfaengerIDs(TreeNodeCollection pin_TreeNode)
 {
     // neue leere Arraylist
     ArrayList pout_AL = new ArrayList();
     // gehe durch alle enthaltenen Knoten
     if (pin_TreeNode.Count != 0)
     {
         foreach(TreeNode tn in pin_TreeNode)
         {
             // gehe durch alle in diesem enthaltenen Knoten Knoten
             if (tn.Nodes != null)
             {
                 ArrayList tmp = HoleAlleAusgewaehltenEmpfaengerIDs(tn.Nodes);
                 if (tmp != null)
                 {
                     // füge Rückgabewerte der aktuellen ArrayList hinzu
                     pout_AL.AddRange(tmp);
                 }
             }
             // prüfe, ob ein Tag-Value existiert
             if (tn.Tag != null)
                 // prüfe, ob das Element ausgewählt wurde
                 if(tn.Checked)
                 {
                     // hole die PelsObject.ID und speichere diese in der ArrayList
                     pout_AL.Add(((Cdv_pELSObject) tn.Tag).ID);
                 }
         }
     }
     else
     {
     }
     return pout_AL;
 }
开发者ID:BackupTheBerlios,项目名称:pels-svn,代码行数:34,代码来源:Cpr_Funk_AllgFkt.cs


示例8: FindNodeByFullPathInt

		internal TreeNode FindNodeByFullPathInt(TreeNodeCollection nodes, String fullPath)
		{
			int pathSep = fullPath.IndexOf(PathSeparator);
			String partPath;
			if (pathSep == -1)
				partPath = fullPath;
			else
				partPath = fullPath.Substring(0, pathSep);
			
			foreach (TreeNode node in nodes)
			{
				if (node.Text.Equals(partPath))
				{
					// We are at the bottom
					if (pathSep == -1)
						return node;
					String restPath = fullPath.Substring
						(PathSeparator.Length + pathSep);
					return FindNodeByFullPathInt(node.Nodes,
												restPath);
				}
			}
			// Not found
			return null;
		}
开发者ID:JohnnyBravo75,项目名称:SharpDevelop,代码行数:25,代码来源:TreeListView.cs


示例9: PopulateNodes

        private void PopulateNodes(DataTable dt, TreeNodeCollection nodes)
        {
            if ((dt == null) || (dt.Rows.Count == 0))
                return;

            if (nodes == null)
            {
                TreeNode tn = new TreeNode();
                tn.Text = "אין קטגוריות";
                tn.ToolTipText = "-1";
                nodes.Add(tn);
            }

            foreach (DataRow dr in dt.Rows)
            {
                string name = dr["CatHebrewName"].ToString().Trim();
                string id = dr["CatId"].ToString().Trim();
                TreeNode tn = new TreeNode();
                tn.Text = name;
                tn.ToolTipText = id;
                try
                {
                    nodes.Add(tn);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }

                DataTable childDT = GetTableFromQuery(String.Format("select * FROM Table_LookupCategories WHERE ParentCatId='{0}'", id));
                PopulateNodes(childDT, tn.Nodes);
            }
        }
开发者ID:haimon74,项目名称:KanNaim,代码行数:33,代码来源:Form_CategoriesManager.cs


示例10: GetNodeByPath

        /// <summary>
        /// Get node by path.
        /// </summary>
        /// <param name="nodes">Collection of nodes.</param>
        /// <param name="path">TreeView path for node.</param>
        /// <returns>Returns null if the node won't be find, otherwise <see cref="TreeNode"/>.</returns>
        public static TreeNode GetNodeByPath(TreeNodeCollection nodes, string path)
        {
            foreach (TreeNode currentNode in nodes)
            {
                if (Path.GetExtension(currentNode.FullPath) != string.Empty)
                {
                    continue;
                }

                if (currentNode.FullPath == path)
                {
                    return currentNode;
                }

                if (currentNode.Nodes.Count > 0)
                {
                    TreeNode treeNode = GetNodeByPath(currentNode.Nodes, path);

                    // Check if we found a node.
                    if (treeNode != null)
                    {
                        return treeNode;
                    }
                }
            }

            return null;
        }
开发者ID:123marvin123,项目名称:PawnPlus,代码行数:34,代码来源:TreeNode.cs


示例11: createProtocol

 private static void createProtocol(TreeNodeCollection tree, Block data)
 {
     Block temp = null;
     foreach (TreeNode t in tree)
     {
         if (t.Name.Equals("block"))
         {
             temp = data.addBlock(t.Text, t.ImageKey, t.SelectedImageKey);
             createProtocol(t.Nodes, temp);
         }
         else
         {
             if (t.Name.Equals("multi"))
             {
                 Field f = data.addField(t.Text, t.Name, "", t.SelectedImageKey);
                 string[] values = t.ImageKey.Split(';');
                 foreach (string s in values)
                 {
                     string[] pair = s.Split(':');
                     ((MultiField)f).addKey(pair[0], pair[1]);
                 }
             }
             else data.addField(t.Text, t.Name, t.ImageKey, t.SelectedImageKey);
         }
     }
 }
开发者ID:vicban3d,项目名称:Hackaton,代码行数:26,代码来源:Facade.cs


示例12: LoadWorkFlowClassSelectNode

        /// <summary>
        /// 选中装载流程类型
        /// </summary>
        /// <param name="key"></param>
        /// <param name="startNodes"></param>
        public static void LoadWorkFlowClassSelectNode(string key, TreeNodeCollection startNodes)
        {
            try
            {
                DataTable table = WorkFlowClass.GetChildWorkflowClass(key);

                
                foreach (DataRow row in table.Rows)
                {
                    WorkFlowClassTreeNode tmpNode = new WorkFlowClassTreeNode();
                    tmpNode.NodeId = row["WFClassId"].ToString();
                    tmpNode.ImageIndex = 0;
                    tmpNode.ToolTipText = "分类";
                    tmpNode.SelectedImageIndex = 0;
                    tmpNode.clLevel = Convert.ToInt16(row["clLevel"]);
                    tmpNode.Text = row["Caption"].ToString();
                    tmpNode.WorkflowFatherClassId = row["FatherId"].ToString();
                    tmpNode.Description = row["Description"].ToString();
                    tmpNode.MgrUrl = row["clmgrurl"].ToString();
                    tmpNode.NodeType = WorkConst.WORKFLOW_CLASS;
                    startNodes.Add(tmpNode);

                    

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:37,代码来源:WorkFlowClassTreeNode.cs


示例13: FillTreeView

        private void FillTreeView(TreeNodeCollection nodeCollection, TabControl tab)
        {
            if (nodeCollection != null && tab != null)
            {
                foreach (TabPage tabPage in tab.TabPages)
                {
                    TreeNode treeNode = new TreeNode(tabPage.Text);
                    if (!string.IsNullOrEmpty(tabPage.ImageKey))
                    {
                        treeNode.ImageKey = treeNode.SelectedImageKey = tabPage.ImageKey;
                    }
                    treeNode.Tag = tabPage;
                    nodeCollection.Add(treeNode);

                    foreach (Control control in tabPage.Controls)
                    {
                        if (control is TabControl)
                        {
                            FillTreeView(treeNode.Nodes, control as TabControl);
                            break;
                        }
                    }
                }
            }
        }
开发者ID:Edison6351,项目名称:ShareX,代码行数:25,代码来源:TabToTreeView.cs


示例14: FindNodeByObject

 internal static NodeBase FindNodeByObject(TreeNodeCollection treeNodeCollection, object obj)
 {
     foreach (NodeBase node in treeNodeCollection)
         if (node.Object == obj)
             return node;
     return null;
 }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:7,代码来源:TreeViewManager.cs


示例15: PopulateTree

 private void PopulateTree(Node currentNode, TreeNodeCollection parentsNodes)
 {
     TreeNode newNode = new TreeNode("[ " + currentNode.Type + "] " + currentNode.Value);
     parentsNodes.Add(newNode);
     foreach (Node child in currentNode.Children)
         PopulateTree(child, newNode.Nodes);
 }
开发者ID:Hammertime38,项目名称:appium-dot-exe,代码行数:7,代码来源:InpsectorForm.cs


示例16: Sort

		public void Sort(TreeNodeCollection col)
		{
			CheckDisposed();

			if (col.Count == 0)
				return;
			List<FeatureTreeNode> list = new List<FeatureTreeNode>(col.Count);
			foreach (FeatureTreeNode childNode in col)
			{
				list.Add(childNode);
			}
			list.Sort();

			BeginUpdate();
			col.Clear();
			foreach (FeatureTreeNode childNode in list)
			{
				col.Add(childNode);
				if (childNode.Nodes.Count > 0)
				{
					if (childNode.Nodes[0].Nodes.Count > 0)
						Sort(childNode.Nodes); // sort all but terminal nodes
					else
					{ // append "none of the above" node to terminal nodes
						FeatureTreeNode noneOfTheAboveNode = new FeatureTreeNode(
							// REVIEW: SHOULD THIS STRING BE LOCALIZED?
							LexTextControls.ksNoneOfTheAbove,
							(int)ImageKind.radio, (int)ImageKind.radio, 0,
							FeatureTreeNodeInfo.NodeKind.Other);
						InsertNode(noneOfTheAboveNode, childNode);
					}
				}
			}
			EndUpdate();
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:35,代码来源:FeatureStructureTreeView.cs


示例17: calculateAllTracesFromFunction

        public static void calculateAllTracesFromFunction(String sSignature, TreeNodeCollection tncTraces,
                                                          List<String> lFunctionsCalled,
                                                          String sFilter_Signature, String sFilter_Parameter,
                                                          bool bUseIsCalledBy, ICirDataAnalysis fcdAnalysis)
        {
            TreeNode tnNewTreeNode = O2Forms.newTreeNode(sSignature, sSignature, 0, sSignature);
            tncTraces.Add(tnNewTreeNode);

            if (fcdAnalysis.dCirFunction_bySignature.ContainsKey(sSignature))
            {
                ICirFunction cfCirFunction = fcdAnalysis.dCirFunction_bySignature[sSignature];
                List<ICirFunction> lsFunctions = new List<ICirFunction>();
                if (bUseIsCalledBy)
                    foreach(var cirFunctionCall in cfCirFunction.FunctionIsCalledBy)
                        lsFunctions.Add(cirFunctionCall.cirFunction);
                else
                    lsFunctions.AddRange(cfCirFunction.FunctionsCalledUniqueList);                                               

                foreach (ICirFunction cirFunction in lsFunctions)
                    if (false == lFunctionsCalled.Contains(cirFunction.FunctionSignature))
                    {
                        lFunctionsCalled.Add(cirFunction.FunctionSignature);
                        calculateAllTracesFromFunction(cirFunction.FunctionSignature, tnNewTreeNode.Nodes, lFunctionsCalled,
                                                       sFilter_Signature, sFilter_Parameter, bUseIsCalledBy,
                                                       fcdAnalysis);
                    }
                    else
                        tnNewTreeNode.Nodes.Add("(Circular ref) : " + cirFunction.FunctionSignature);
            }
        }
开发者ID:pusp,项目名称:o2platform,代码行数:30,代码来源:TraceAnalysis.cs


示例18: GrhTreeViewFolderNode

 /// <summary>
 /// Initializes a new instance of the <see cref="GrhTreeViewFolderNode"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="subCategory">The sub category.</param>
 GrhTreeViewFolderNode(TreeNodeCollection parent, string subCategory)
 {
     _subCategory = subCategory;
     Name = FullCategory;
     parent.Add(this);
     Text = SubCategory;
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:12,代码来源:GrhTreeViewFolderNode.cs


示例19: fromTreeNodeListCalculateRulesToAdd_recursive

 public void fromTreeNodeListCalculateRulesToAdd_recursive(TreeNodeCollection tncTreeNodes,
                                                           List<String> lsRulesToAdd, CirData fadCirData)
 {
     foreach (TreeNode tnTreeNode in tncTreeNodes)
     {
         if (fadCirData.dClasses_bySignature.ContainsKey(tnTreeNode.Text))
         {
             ICirClass ccCirClass = fadCirData.dClasses_bySignature[tnTreeNode.Text];
             foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values)
                 foreach (TreeNode tnChildNode in tnTreeNode.Nodes)
                 {
                     String sGetterVersion = tnChildNode.Text.Replace("set", "get");
                     if (new FilteredSignature(cfCirFunction.FunctionSignature).sFunctionName == sGetterVersion)
                     {
                         if (false == lsRulesToAdd.Contains(cfCirFunction.FunctionSignature))
                             lsRulesToAdd.Add(cfCirFunction.FunctionSignature);
                     }
                     if (tnChildNode.Nodes.Count > 0)
                         fromTreeNodeListCalculateRulesToAdd_recursive(tnChildNode.Nodes, lsRulesToAdd,
                                                                       fadCirData);
                 }
         }
         //   String sClass = tnTreeNode.Text;
     }
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects.Misc_and_Legacy,代码行数:25,代码来源:ascx_SpringMvcAnalyzer.cs


示例20: SetzeAlleAusgewaehltenEmpfaenger

 /// <summary>
 /// setzt Häkchen bei allen Elementen deren ID in der übergebenen
 /// ID-Menge enthalten ist
 /// </summary>
 /// <param name="pin_TreeNode"></param>
 /// <param name="pin_IDMenge"></param>
 public static void SetzeAlleAusgewaehltenEmpfaenger(
     TreeNodeCollection pin_TreeNode, int[] pin_IDMenge)
 {
     if (pin_IDMenge != null)
         // gehe durch alle enthaltenen Knoten
         if (pin_TreeNode.Count != 0)
         {
             foreach(TreeNode tn in pin_TreeNode)
             {
                 tn.Checked = false;
                 // gehe durch alle in diesem enthaltenen Knoten Knoten
                 if (tn.Nodes != null)
                 {
                     SetzeAlleAusgewaehltenEmpfaenger(tn.Nodes, pin_IDMenge);
                 }
                 // prüfe, ob ein Tag-Value existiert
                 if (tn.Tag != null)
                     // prüfe, ob das Element ausgewählt wurde
                     foreach(int ID in pin_IDMenge)
                     {
                         if (((Cdv_pELSObject)tn.Tag).ID == ID)
                         {
                             tn.Checked = true;
                         }
                     }
             }
         }
 }
开发者ID:BackupTheBerlios,项目名称:pels-svn,代码行数:34,代码来源:Cpr_Funk_AllgFkt.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.TreeNodeMouseClickEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.TreeNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap