Example #1
0
        void ButtonClick(object sender, System.EventArgs e)
        {
            // Get the clicked button...
            Button clickedButton = (Button)sender;
            // ... and it's tabindex
            int clickedButtonTabIndex = clickedButton.TabIndex;

            // Send each button to top or bottom as appropriate
            foreach (Control ctl in CaseAndControlPanel.Controls)
            {
                if (ctl is Button)
                {
                    Button btn = (Button)ctl;
                    if (btn.TabIndex > clickedButtonTabIndex)
                    {
                        if (btn.Dock != DockStyle.Bottom)
                        {
                            btn.Dock = DockStyle.Bottom;
                            // This is vital to preserve the correct order
                            btn.BringToFront();
                        }
                    }
                    else
                    {
                        if (btn.Dock != DockStyle.Top)
                        {
                            btn.Dock = DockStyle.Top;
                            // This is vital to preserve the correct order
                            btn.BringToFront();
                        }
                    }
                }
            }

            // Determine which button was clicked.
            switch (clickedButton.Text.Substring(0, 2))
            {
            case "测试":
                ControlPannel.Visible = false;
                TestCasePanel.Visible = true;
                TestCasePanel.BringToFront();
                break;

            case "设置":
                TestCasePanel.Visible = false;
                ControlPannel.Visible = true;
                ControlPannel.BringToFront();
                break;
            }
        }
Example #2
0
 private void Start()
 {
     animator = this.GetComponent <Animator>();
     cp       = GetComponentInParent <ControlPannel>();
     audioS   = GetComponent <AudioSource>();
 }