本文整理汇总了C#中System.Windows.Forms.TreeView.GetNodeCount方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.GetNodeCount方法的具体用法?C# TreeView.GetNodeCount怎么用?C# TreeView.GetNodeCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeView
的用法示例。
在下文中一共展示了TreeView.GetNodeCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToggleShowSelectedNodes
public void ToggleShowSelectedNodes(bool showSelectedNodes, TreeView root = null) {
Plugin.OnlyShowFrequentlyUsedNodes = showSelectedNodes;
Settings.Default.OnlyShowFrequentlyUsedNodes = Plugin.OnlyShowFrequentlyUsedNodes;
Plugin.SetFrequentlyUsedNodeGroups();
if (root == null) {
root = this.treeView;
}
root.BeginUpdate();
root.Nodes.Clear();
IList<NodeGroup> nodeGroups = Plugin.OnlyShowFrequentlyUsedNodes ? Plugin.FrequentlyUsedNodeGroups : Plugin.NodeGroups;
foreach(NodeGroup group in nodeGroups) {
group.Register(root.Nodes);
}
if (root.GetNodeCount(false) > 0) {
UIUtilities.SortTreeview(root.Nodes);
root.SelectedNode = this.treeView.Nodes[0];
}
root.EndUpdate();
}
示例2: calculateO2TraceBlocksIntoTreeView
public static void calculateO2TraceBlocksIntoTreeView(Dictionary<String, O2TraceBlock_OunceV6> dO2TraceBlock,
ref TreeView tvTargetTreeView)
{
DI.log.info("incalculateO2TraceBlocksIntoTreeView: {0}", dO2TraceBlock.Keys.Count);
O2Timer tTimer = new O2Timer("Calculating Raw Data TreeView").start();
tvTargetTreeView = new TreeView();
var itemsProcessed = 0;
var itemsToProcess = dO2TraceBlock.Keys.Count;
var updateInterval = 1000;
foreach (var sSignature in dO2TraceBlock.Keys)
{
if (itemsProcessed++ % updateInterval == 0)
DI.log.info("[{0}/{1}]", itemsProcessed, itemsToProcess);
O2TraceBlock_OunceV6 otdO2TraceBlockOunceV6 = dO2TraceBlock[sSignature];
//String sRootNodeText = String.Format("{0} {1} {2}", otdO2TraceBlockOunceV6.sSignature, System.IO.Path.GetFileName(otdO2TraceBlockOunceV6.sFile),otdO2TraceBlockOunceV6.sLineNumber);
String sRootNodeText = String.Format("{0} {1} {2}", otdO2TraceBlockOunceV6.sSignature,
otdO2TraceBlockOunceV6.sFile, otdO2TraceBlockOunceV6.sLineNumber);
TreeNode tnRootNode = O2Forms.newTreeNode(sRootNodeText, sRootNodeText, 0, otdO2TraceBlockOunceV6);
// handle Sinks
TreeNode tnSinks = O2Forms.newTreeNode("Sinks", "Sinks", 0, null);
foreach (AssessmentAssessmentFileFinding fFinding in otdO2TraceBlockOunceV6.dSinks.Keys)
{
String sSink = getUniqueSignature(fFinding, TraceType.Known_Sink,
otdO2TraceBlockOunceV6.dSinks[fFinding], true);
// analysis.Analysis.getSink(fFinding, otdO2TraceBlockOunceV6.dSinks[fFinding]);
if (!string.IsNullOrEmpty(sSink) || sSink != sRootNodeText)
{
TreeNode tnSink = O2Forms.newTreeNode(sSink, sSink, 0, null);
tnSinks.Nodes.Add(tnSink);
}
}
tnRootNode.Nodes.Add(tnSinks);
TreeNode tnSources = O2Forms.newTreeNode("Sources", "Sources", 0, null);
foreach (AssessmentAssessmentFileFinding fFinding in otdO2TraceBlockOunceV6.dSources.Keys)
{
String sSource = getUniqueSignature(fFinding, TraceType.Source,
otdO2TraceBlockOunceV6.dSources[fFinding], true);
if (sSource == "" || sSource == null || sSource != sRootNodeText)
{
TreeNode tnSource = O2Forms.newTreeNode(sSource, sSource, 0, null);
tnSources.Nodes.Add(tnSource);
}
}
tnRootNode.Nodes.Add(tnSources);
tvTargetTreeView.Nodes.Add(tnRootNode);
}
DI.log.info("[{0}/{1}]", itemsProcessed, itemsToProcess);
//tvTargetTreeView.Sort(); // removed for performance reasons
//tvAllTraces.Nodes.AddRange(tvRawData.Nodes);
//tvAllTraces = tvRawData;
tTimer.stop();
DI.log.info("Tree View with Raw Data Calculated: It has {0} ({1}) Nodes (SubNodes)",
tvTargetTreeView.GetNodeCount(false), tvTargetTreeView.GetNodeCount(true));
}