C#找控件的父容器

 

private void kryptonButton1_Click(object sender, EventArgs e)
        {
            User test = new User();           
            KryptonSplitterPanel kp= this .Parent as KryptonSplitterPanel;
            kp.Controls.Clear();
            kp.Controls.Add(test);
          
        }



 private void toolStripButton8_Click(object sender, EventArgs e)
        {
            tsAllNocheck();
            kryptonSplitContainer1.Panel2.Controls.Clear();
            User home = new User();
            kryptonSplitContainer1.Panel2.Controls.Add(home);
            toolStripButton8.CheckState = CheckState.Checked;
        }


你可能感兴趣的:(C#找控件的父容器)