public void PopulateTreeView(TreeView tv) { tv.Nodes.Add(StartPositions.GetTreeNode()); int i = 0; tv.Nodes[i].Tag = StartPositions; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(EnemyRoutes.GetTreeNode()); tv.Nodes[i].Tag = EnemyRoutes; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(ItemRoutes.GetTreeNode()); tv.Nodes[i].Tag = ItemRoutes; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(GliderRoutes.GetTreeNode()); tv.Nodes[i].Tag = GliderRoutes; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(CheckPoints.GetTreeNode()); tv.Nodes[i].Tag = CheckPoints; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(RespawnPoints.GetTreeNode()); tv.Nodes[i].Tag = RespawnPoints; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(Objects.GetTreeNode()); tv.Nodes[i].Tag = Objects; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(Routes.GetTreeNode()); tv.Nodes[i].Tag = Routes; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(Area.GetTreeNode()); tv.Nodes[i].Tag = Area; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(Camera.GetTreeNode()); tv.Nodes[i].Tag = Camera; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; tv.Nodes.Add(StageInformation.GetTreeNode()); tv.Nodes[i].Tag = StageInformation; tv.Nodes[i].ImageIndex = i + 1; tv.Nodes[i].SelectedImageIndex = i + 1; i++; foreach (TreeNode node in tv.Nodes) { if (node.Tag is ISectionBase) { node.Checked = ((ISectionBase)node.Tag).GetVisibility(); foreach (TreeNode subnode in node.Nodes) { subnode.Checked = ((ISectionBase)subnode.Tag).GetVisibility(); } } } }