노드를 추가하는 재귀 프로그램이 있습니다. treeview를 사용하고 있지만이를 수행하기위한 상향식 접근 방법을 원합니다.하위 노드를 포함하여 노드에서 선택된 ChildNodes의 수를 얻고 싶습니다.
지금까지 이런 짓을했는지하지만
를 작동하지private void TreeviewCountCheckedNodes(TreeNodeCollection treeNodeCollection)
{
TreeNode node = treeNodeCollection[0];
int countchecked = 0;
if (node != null)
{
foreach (TreeNode childnode in node.Nodes)
{
if (childnode.Nodes.Count == 0 && childnode.Checked)
{
countchecked++;
}
else if (childnode.Nodes.Count > 0)
{
TreeviewCountCheckedNodes(childnode.Nodes);
}
}
}
}
안녕하세요. 오버플로를 환영합니다. [지금까지 해본 내용을 반영하여 질문을 편집 할 수 있습니까?] (http://mattgemmell.com/2008/12/08/what-have-you-tried/) – kush
프로그래밍 언어를' 태그'는 코드 하이라이트를 얻기 위해 – Simulant
@Simulant 알지 못 했습니까, 깔끔하게. – Rawling