本文整理汇总了C#中System.Windows.Forms.TreeNodeCollection.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Cast方法的具体用法?C# TreeNodeCollection.Cast怎么用?C# TreeNodeCollection.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.Cast方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearProjectNodes
private void ClearProjectNodes(TreeNodeCollection nodes)
{
var treeNodes = nodes.Cast<TreeNode>().ToArray();
foreach (var treeNode in treeNodes)
{
treeNode.Tag = null;
_projects.Nodes.Remove(treeNode);
}
}
示例2: RefreshNodeColors
void RefreshNodeColors(TreeNodeCollection nodes, bool recursive)
{
foreach (var node in nodes.Cast<GenericNode>())
{
if (recursive) RefreshNodeColors(node.Nodes, recursive);
node.BackColor = this.BackColor;
node.ForeColor = this.ForeColor;
node.ForeColorRequest = this.ForeColor;
}
}
示例3: ProcessPath
public void ProcessPath(IEnumerable<String> path, TreeNodeCollection nodes)
{
if (!path.Any())
return;
var node = nodes.Cast<TreeNode>().FirstOrDefault(n => n.Text == path.First());
if (node == null)
{
node = new TreeNode(text: path.First());
nodes.Add(node);
}
ProcessPath(path.Skip(1), node.Nodes);
}
示例4: ResetAllNodeHighlighting
private void ResetAllNodeHighlighting(TreeNodeCollection nodes)
{
labelNumFound.Text = "";
foreach (var node in nodes.Cast<TreeNode>())
{
HighlightNode(node, false);
ResetAllNodeHighlighting(node.Nodes);
}
}
示例5: GetCompoundExpression
private Expression GetCompoundExpression(string quantifier, TreeNodeCollection nodes)
{
if (nodes == null || nodes.Count < 1)
return Expression.Constant(true);
Expression result = null;
var first = true;
foreach (var subCondition in nodes.Cast<TreeNode>().Select(GetExpression))
{
result = first ? subCondition : Expression.MakeBinary(ExpressionType.AndAlso, result, subCondition);
first = false;
}
return result;
}
示例6: UpdateChildTreeNodes
private void UpdateChildTreeNodes(TreeNodeCollection collection, IEnumerable<ISymbol> symbols) {
foreach (ISymbol symbol in symbols) {
if (symbol is ProgramRootSymbol) continue;
if (symbol is Defun) continue;
TreeNode node = collection.Cast<TreeNode>().Where(n => n.Tag == symbol).FirstOrDefault();
if (node == null) {
node = new TreeNode();
node.Tag = symbol;
collection.Add(node);
}
node.Checked = symbol.Enabled;
node.Text = symbol.Name;
var groupSymbol = symbol as GroupSymbol;
if (groupSymbol != null) UpdateChildTreeNodes(node.Nodes, groupSymbol.Symbols);
}
}
示例7: HideUnmarkedNodes
private bool HideUnmarkedNodes(TreeNodeCollection nodes)
{
bool hasMarks = false;
var nodess = nodes.Cast<CustomTreeNode>().ToArray();
foreach (TreeNode tnode in nodess)
{
if (tnode == null)
{
continue;
}
CustomTreeNode node = (CustomTreeNode)tnode;
if (!string.IsNullOrEmpty(node.Tags))
{
hasMarks = true;
continue;
}
if (node.Nodes.Count > 0)
{
var hasChildMarks = HideUnmarkedNodes(node.Nodes);
if (hasChildMarks)
{
hasMarks = true;
}
else
{
node.Remove();
}
}
if (node.Nodes.Count == 0 && string.IsNullOrEmpty(node.Tags))
{
node.Remove();
}
}
return hasMarks;
}
示例8: FindChildlessNode
private static TreeNode FindChildlessNode(TreeNodeCollection nodes)
{
return nodes.Cast<TreeNode>().FirstOrDefault(node => node.Nodes.Count == 0);
}
示例9: nameAllNodes
private void nameAllNodes(TreeNodeCollection Nodes)
{
List<TreeNode> allNodes = Nodes.Cast<TreeNode>().ToList();
//flatten tree of nodes into list.
for (int i = 0; i < allNodes.Count(); i++)
{
allNodes[i].Name = i.ToString();
allNodes.AddRange(allNodes[i].Nodes.Cast<TreeNode>());
}
}