其他分享
首页 > 其他分享> > winform 填充panel

winform 填充panel

作者:互联网

public void CreatForm(Form frm)
{
panel1.Controls.Clear();//清除panel里面得所有内容
frm.TopLevel = false; //取消顶级
frm.FormBorderStyle = FormBorderStyle.None;//将边框设置为无边框,无法拖动
frm.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
frm.Dock = DockStyle.Fill; //填充整个Panel容器
panel1.Controls.Add(frm); //将传进来的窗体添加到Panel容器中
frm.Show();
}

 

 

private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
switch (treeView1.SelectedNode.Text)
{
case "xxx":
CreatForm(new unit());
break;
case "xxx":

标签:填充,FormBorderStyle,AnchorStyles,Controls,frm,panel1,panel,winform
来源: https://www.cnblogs.com/mig21/p/12455034.html