You can try this (warning: I typed this off the top of my head so it may need some tweaks):
private void TreeNode_Clicked(object sender, TreeViewCancelEventArgs e)
{
bool checkChildren = (e.Node.Checked);
if (node.Nodes.Count == 0)
{
return;
}
foreach (TreeNode childNode in e.Node.Nodes)
{
childNode.Checked = !childNode.Checked;
}
}