示例#1
0
        private void ClearAllUcl()
        {
            try
            {
                if (_UserControl1 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl1);
                    _UserControl1.CloseBrowser();
                    _UserControl1 = null;
                }

                if (_UserControl2 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl2);
                    _UserControl2 = null;
                }

                if (_UserControl3 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl3);
                    _UserControl3 = null;
                }

                if (_UserControl4 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl4);
                    _UserControl4 = null;
                }

                if (_UserControl5 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl5);
                    _UserControl5 = null;
                }

                if (_UserControl6 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl6);
                    _UserControl6 = null;
                }

                if (_UserControl7 != null)
                {
                    pnlSetting.Controls.Remove(_UserControl7);
                    _UserControl7 = null;
                }
            }
            catch { }
        }
示例#2
0
        public void SetChangeControl(string sTag)
        {
            switch (sTag)
            {
            case "UserControl1":
                if (_UserControl1 == null)
                {
                    _UserControl1 = new UserControl1();
                }
                _USER_CONTROL = _UserControl1;
                break;

            case "UserControl2":
                if (_UserControl2 == null)
                {
                    _UserControl2 = new UserControl2();
                }
                _USER_CONTROL = _UserControl2;
                break;

            case "UserControl3":
                if (_UserControl3 == null)
                {
                    _UserControl3 = new UserControl3();
                }
                _USER_CONTROL = _UserControl3;
                break;

            case "UserControl4":
                if (_UserControl4 == null)
                {
                    _UserControl4 = new UserControl4();
                }
                _USER_CONTROL = _UserControl4;
                break;

            case "UserControl5":
                if (_UserControl5 == null)
                {
                    _UserControl5 = new UserControl5();
                }
                _USER_CONTROL = _UserControl5;
                break;

            case "UserControl6":
                if (_UserControl6 == null)
                {
                    _UserControl6 = new UserControl6();
                }
                _USER_CONTROL = _UserControl6;
                break;

            case "UserControl7":
                if (_UserControl7 == null)
                {
                    _UserControl7 = new UserControl7();
                }
                _USER_CONTROL = _UserControl7;
                break;
            }

            _SettingUcl.Visible = false;
            _SettingUcl.SendToBack();

            _USER_CONTROL.BringToFront();
            _USER_CONTROL.Dock = DockStyle.Fill;
            pnlSetting.Controls.Add(_USER_CONTROL);
        }