C# 双击TableLayoutPanel中某个控件全屏显示,再次双击恢复原貌

程序中用到的TableLayoutPanel有两行两列,在(1,1)处有一picturebox

现在要实现双击该picturebox全屏显示(状态栏和菜单栏一起显示),代码:

        private void pictureBoxRealPlayView_DoubleClick(object sender, EventArgs e)
        {
            if (changed)
            {
                changed = false;
                tableLayoutPanel1.Controls.Add(pictureBoxRealPlayView);
                pictureBoxRealPlayView.Parent = tableLayoutPanel1;
                pictureBoxRealPlayView.Dock = DockStyle.Fill;
                tableLayoutPanel1.Show();
            }
            else
            {
                changed = true;                
                tableLayoutPanel1.Controls.Remove(pictureBoxRealPlayView);
                pictureBoxRealPlayView.Parent = this;
                pictureBoxRealPlayView.BringToFront();                
                pictureBoxRealPlayView.Dock = DockStyle.Fill;
                tableLayoutPanel1.Hide();
            }                        
        }

你可能感兴趣的:(C# 双击TableLayoutPanel中某个控件全屏显示,再次双击恢复原貌)