Пример #1
0
        public UserControl UcSetting = new UserControl(); // holds current settings user control
        void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            var tmp = new UserControl();

            switch (e.Node.Name)
            {
            case "General":     // General
                tmp = new SettingsTree.General();
                break;

            case "AutoPos":     // Auto postion
                tmp = new SettingsTree.AutoPosition();
                break;

            case "PingCheck":
            case "ConnectionCheck":
                tmp = new SettingsTree.ConnectionCheck();
                break;

            case "IpHostCheck":
                tmp = new SettingsTree.IpHostCheck();
                break;

            case "AntiIdle":
                tmp = new SettingsTree.AntiIdle();
                break;

            case "ProfileKickstart":
                tmp = new SettingsTree.ProfileKickstart();
                break;

            case "HotKeys":
                tmp = new SettingsTree.HotKeys();
                break;

            case "Stats":
                tmp = new SettingsTree.Stats();
                break;
            }

            // Check if new user control should be displayed
            if (!tmp.Name.Equals(UcSetting.Name))
            {
                //var c = tabControl1.TabPages[1].Controls;
                var c = SettingsPanel.Controls;
                if (c.Contains(UcSetting))
                {
                    c.Remove(UcSetting);
                }

                UcSetting = tmp;
                //_ucSetting.Left = 180;
                c.Add(UcSetting);
            }
        }
        void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Left) return;

            var tmp = new UserControl();
            switch (e.Node.Name)
            {
                case "General": // General
                    tmp = new SettingsTree.General();
                    break;
                case "AutoPos": // Auto postion
                    tmp = new SettingsTree.AutoPosition();
                    break;
                case "PingCheck":
                case "ConnectionCheck":
                    tmp = new SettingsTree.ConnectionCheck();
                    break;
                case "IpHostCheck":
                    tmp = new SettingsTree.IpHostCheck();
                    break;
                case "AntiIdle":
                    tmp = new SettingsTree.AntiIdle();
                    break;
                case "ProfileKickstart":
                    tmp = new SettingsTree.ProfileKickstart();
                    break;
                case "HotKeys":
                    tmp = new SettingsTree.HotKeys();
                    break;
            }

            // Check if new user control should be displayed
            if (!tmp.Name.Equals(UcSetting.Name))
            {
                //var c = tabControl1.TabPages[1].Controls;
                var c = SettingsPanel.Controls;
                if (c.Contains(UcSetting)) c.Remove(UcSetting);

                UcSetting = tmp;
                //_ucSetting.Left = 180;
                c.Add(UcSetting);
            }
        }