如何获得指定对象它所在的容器控件
比如button 放置于panel1中那它的所在容器控件就是panel1
如果放置于form1中那么它的说在容器对象就是form1
如何获得

解决方案 »

  1.   

            private void button1_Click(object sender, EventArgs e)
            {
              
                MessageBox.Show(ShowName(button1));
            }        private string ShowName(Control c)
            {
                return c.Parent.Name;
            }
      

  2.   

    Parent没错就是这个属性 谢了