private void _battle_treeView_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Action == TreeViewAction.ByKeyboard || e.Action == TreeViewAction.ByMouse) { TreeNode node = e.Node; bool check = node.Checked; TagData tagData = node.Tag as TagData; NodeTypes nodeType = (NodeTypes)tagData.NodeType; switch (nodeType) { case NodeTypes.Obstacles: _drawData.DrawObstacels = check; break; case NodeTypes.Regions: _drawData.DrawRegions = check; break; case NodeTypes.Region: _drawData.SetRegion(check, tagData.GetRegionLink()); break; } Redraw(); } }