首页 > 代码库 > C# Panel 打开 Form 窗口的方法

C# Panel 打开 Form 窗口的方法

技术分享

private void MainForm_Load(object sender, EventArgs e)
{
NavigationForm w = new NavigationForm();

ShowForm(w);
}

public void ShowForm(Form form1)
{
this.panel1.Controls.Clear();

form1.TopLevel = false;

form1.Anchor = AnchorStyles.None;

form1.FormBorderStyle = FormBorderStyle.None;

form1.WindowState = FormWindowState.Maximized;

this.panel1.Controls.Add(form1);

form1.Show();
}

C# Panel 打开 Form 窗口的方法