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