コード例 #1
0
        private void navigationTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            ContentPanel replacer = (ContentPanel)navigationTree.SelectedNode.Tag;

            if (!replacer.isInitialized)
            {
                replacer.init();
                replacer.changeEvent += new UpdatedPanelEventHandler(panel_hasChanged);
            }
            else
            {
                replacer.update();
            }

            if (mainContents.Controls.Count > 0 && mainContents.Controls[0] as ContentPanel != null)
            {
                ((ContentPanel)mainContents.Controls[0]).close();
            }

            mainContents.Controls.Clear();
            mainContents.Controls.Add(replacer);
            //replacer.update();
            //Mark it
            foreach (TreeNode node in navigationTree.Nodes)
            {
                node.BackColor = System.Drawing.Color.White;
                foreach (TreeNode child in node.Nodes)
                {
                    child.BackColor = System.Drawing.Color.White;
                }
            }
            navigationTree.SelectedNode.BackColor = System.Drawing.Color.FromArgb(215, 215, 215);
        }