private static int _GetVisibleNodesAmount(TreeNode node, int currentAmount)
{
if (node.IsVisible) currentAmount++;
else return currentAmount;
if (node.IsExpanded)
for (int i = 0; i < node.Nodes.Count; i++)
currentAmount = _GetVisibleNodesAmount(node.Nodes[i], currentAmount);
return currentAmount;
}