最大化继承母版页(表单)的用户控件

时间:2012-11-11 08:16:05

标签: c# winforms user-controls master-pages fullscreen

我有C#windows应用程序中的主页面。在母版页中,我设置了许多面板和按钮。其中一个(面板)是主面板。在运行时,程序(表格的主页)最大化,当点击按钮时,用户控件放在主面板中。但不是最大化!!!! 如何在运行时最大化用户控制?

主页中的

private void bntContentEnter_Click_1(object sender, EventArgs e)
        {
            UserControlEnter_Parking u = new UserControlEnter_Parking();

            MasterPanel.Controls.Clear();
            ShowFullScreen(u);
            MasterPanel.Controls.Add(u);
        }


 private void ShowFullScreen(UserControl userControl)
        {
            Form fullScreenForm = new Form();
            fullScreenForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            fullScreenForm.WindowState = FormWindowState.Maximized;
            fullScreenForm.ShowInTaskbar = false;
            userControl.Dock = DockStyle.Fill;
            fullScreenForm.Controls.Add(userControl);
            fullScreenForm.Show();
        }

0 个答案:

没有答案