0

我有 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();
        }
4

0 回答 0